我希望使用引導圖標進行編輯,刪除和詳細信息。默認給予如何將變更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>」到‘字串’
從'@ Url.Action'中刪除'new {data_modal =「」}'。我假設你想添加一個html屬性到''元素? –
「Url.Action」方法中第四個參數的用途應該是什麼?根據[MSDN](https://msdn.microsoft.com/en-us/library/system.web.mvc.urlhelper.action(v = vs.118).aspx),它是協議,所以第一個評論說,你一定要刪除它。 – 0xDECAFBAD
第四個參數是**協議**,所以你不能應用字符串值。 –