加入jQuery Mobile的过渡到ASP.Net MVC格式 [英] Add jQuery Mobile transition to ASP.Net MVC Form

查看:172
本文介绍了加入jQuery Mobile的过渡到ASP.Net MVC格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何一个jQuery Mobile的过渡添加到使用ASP.Net MVC Html.BeginForm 帮手?

呈现一个HTML POST

过渡需要一个HTML属性添加数据转换(我认为到格式标记,但文档还不清楚在这一点上,只提供一个超级链接的例子)。

我试图使用 BeginForm 超负荷属性添加到渲染格式标记。当使用新{...} 语法来声明一个匿名类重presenting的HTML属性,我得到一个错误,如果属性名称中有破折号

 使用(Html.BeginForm(登录,帐户,FormMethod.Post,
    新{数据过渡=啪}))

错误:无效的匿名类型成员声明

本,尽管事实,即 MSDN文档节目在名称中使用破折号属性

 新{ID =text1中,接收字符集=ISO-8859-1}


解决方案

创建词典:

 使用(Html.BeginForm(登录,帐户,FormMethod.Post,
    新字典<字符串对象> {{数据转换,啪}}))

How does one add a jQuery Mobile transition to an HTML POST rendered with the ASP.Net MVC Html.BeginForm helper?

The transition requires an HTML attribute data-transition be added (I think to the form tag, but the docs are unclear on that point, providing only a hyperlink example).

I'm trying to use the BeginForm overload to add attributes to the rendered form tag. When using the new { ... } syntax to declare an anonymous class representing the HTML attributes, I get an error if an attribute name has a dash in it.

using (Html.BeginForm("Login", "Account", FormMethod.Post, 
    new {  data-transition="pop" }))

Error: Invalid anonymous type member declarator

This, in spite of the fact that the MSDN documentation shows an attribute with a dash in the name

new { id = "text1", accept-charset="iso-8859-1" }

解决方案

Create a dictionary:

using (Html.BeginForm("Login", "Account", FormMethod.Post, 
    new Dictionary<string, object>{{ "data-transition", "pop" }} ))

这篇关于加入jQuery Mobile的过渡到ASP.Net MVC格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆