0
Ajax.ActionLinkでhtmlAttributesを使用しているときに誤ったクエリーストリングがレンダリングされる問題を知っている人はいますか? htmlAttributesに空の配列を入れても、リンクが正しくレンダリングされないようです。ここに私のコードです。htmlAttributesを使用しているときにAjax.ActionLinkでリンクが正しく表示されない問題
私はこれを行うと(新しい{}注):
<%= Ajax.ActionLink("Delete", "Delete", "Milestone", new RouteValueDictionary { { "id", Model.Id } }, new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "ModalDeleteContainer", OnSuccess = "modalDelete" }, new { })%>
リンクは次のようにレンダリング:
<a href="/Client/1/Admin/Milestone/Delete?Count=1&Keys=System.Collections.Generic.Dictionary%602%2BKeyCollection%5BSystem.String%2CSystem.Object%5D&Values=System.Collections.Generic.Dictionary%602%2BValueCollection%5BSystem.String%2CSystem.Object%5D" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, httpMethod: 'GET', updateTargetId: 'ModalDeleteContainer', onSuccess: Function.createDelegate(this, modalDelete) });">Delete</a>
私はこれを行う場合(NULLの代わりに新しい{}):
を<%= Ajax.ActionLink("Delete", "Delete", "Milestone", new RouteValueDictionary { { "id", Model.Id } }, new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "ModalDeleteContainer", OnSuccess = "modalDelete" }, null)%>
のリンクは次のようにレンダリング:
<a href="/Client/1/Admin/Milestone/Delete/703c749e-c145-4cf1-90eb-9bee00bac79d" onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, httpMethod: 'GET', updateTargetId: 'ModalDeleteContainer', onSuccess: Function.createDelegate(this, modalDelete) });">Delete</a>
唯一の違いは、Ajax.ActionLinkの最後のhtmlAttributes引数です。どんな洞察もありがとう!
素晴らしいです。ありがとう! –