2016-10-02 17 views
-1

我希望使用引導圖標進行編輯,刪除和詳細信息。默認給予如何將變更html動作更改爲mvc中的url動作

@Html.ActionLink("Edit", "Edit", new { id = item.UserID }, new { data_modal = "" })

我想修改它使用一個圖標來表示,所以我編輯它以

<a href="@Url.Action("Edit", "Edit", new { id = item.UserID }, new { data_modal = "" })" class="btn btn-warning"> 
    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> 
</a> 

我得到的錯誤是

錯誤CS1503參數3:無法從 '<匿名類型:int id>'轉換爲'System.Web.Routing.RouteValueDictionary'

錯誤CS1503參數4:不能從 轉換「」 <匿名類型:字符串data_modal>」到‘字串’

回答

0

由於錯誤已經指出第三個參數應該是一個RoutedValueDictionary而不是一個匿名對象。

根據MSDN,函數調用的正確過載爲Url.Action("Edit", "Edit", new { id = item.UserID })