gig*_*ean 2 asp.net-mvc jquery-mobile
我有一个简单按钮的可视化问题,这很好地呈现
@Html.ActionLink("<", "Monthly", "Agenda", null, new Dictionary<string, object> { { "data-role", "button" }, { "data-theme", "c" }, { "data-mini", "true" } })
Run Code Online (Sandbox Code Playgroud)
我正在调用的动作虽然需要参数,但我改变了它
@Html.ActionLink("<", "Monthly", "Agenda", new { shift = -1 }, new Dictionary<string, object> { { "data-role", "button" }, { "data-theme", "c" }, { "data-mini", "true" } })
Run Code Online (Sandbox Code Playgroud)
以下是HTML.ActionLink方法的答案
当我按上面的方式更改它时按钮执行它的工作,但它不再呈现为jquery移动按钮
它来自这个http://i47.tinypic.com/alhs9h.png
到这个http://i48.tinypic.com/351ft5z.png
谢谢你帮助我
要达到正确的Html.ActionLink重载,您需要将RouteValues作为RouteValueDictionary(不是匿名对象)传递:
@Html.ActionLink("<", "Monthly", "Agenda",
new RouteValueDictionary() { { "shift", -1 } },
new Dictionary<string, object> { { "data-role", "button" }, { "data-theme", "c" }, { "data-mini", "true" } })
Run Code Online (Sandbox Code Playgroud)
另外,较短/更易于阅读,你可以通过双方的RouteValues和HtmlAttributes为匿名对象:
@Html.ActionLink("<", "Monthly", "Agenda", new { shift = -1 }, new { data_role = "button", data_theme = "c", data_mini = "true" })
Run Code Online (Sandbox Code Playgroud)
在匿名对象版本中,您必须使用data_而不是data-,但是在显示属性键之前帮助程序会替换_,-因此输出是相同的.
| 归档时间: |
|
| 查看次数: |
3173 次 |
| 最近记录: |