关于HtmlAttributes无法指定Jquery Mobile中的一些元素的解决方法

在Jquery Mobile中如果要指定一个按钮,可以写成

<a href=”Home/About” data-role="button">关于</a>

但是在Html.ActionLink中会有一些问题

<%=Html.ActionLink("关于","About","Home",null,new{@data-role="button"})%>这样写会报错的。

目前的解决办法有两种

1.

<a href="<%=Url.Action("About","Home")%>" data-role="button">关于</a>

2.

<%=Html.ActionLink("关于", "About", null, new Dictionary<string, object> { { "data-role","button" } })%>

  

posted @ 2011-10-31 13:35  夜明的孤行灯  阅读(497)  评论(2编辑  收藏  举报
返回顶部