html.actionlink

ActionLink htmlAttributes

≡放荡痞女 提交于 2019-11-26 12:56:08
问题 WORKS <a href=\"@Url.Action(\"edit\", \"markets\", new { id = 1 })\" data-rel=\"dialog\" data-transition=\"pop\" data-icon=\"gear\" class=\"ui-btn-right\">Edit</a> DOES NOT WORK - WHY? @Html.ActionLink(\"Edit\", \"edit\", \"markets\", new { id = 1 }, new {@class=\"ui-btn-right\", data-icon=\"gear\"}) It seems you can\'t pass something like data-icon=\"gear\" into htmlAttributes? Suggestions? 回答1: The problem is that your anonymous object property data-icon has an invalid name. C# properties

ASP.NET MVC Ajax.ActionLink with Image

懵懂的女人 提交于 2019-11-26 04:39:49
问题 is there anyway to have an image act as an ajax actionlink? I can only get it to work using text. Thanks for your help! 回答1: From Stephen Walthe, from his Contact manger project public static class ImageActionLinkHelper { public static string ImageActionLink(this AjaxHelper helper, string imageUrl, string altText, string actionName, object routeValues, AjaxOptions ajaxOptions) { var builder = new TagBuilder("img"); builder.MergeAttribute("src", imageUrl); builder.MergeAttribute("alt", altText