如何在服务器端 .NET 中使用 HTML5 电子邮件输入类型 [英] How can I use HTML5 email input type with server-side .NET
问题描述
据我所知,HTML5 中的 元素将在不支持标签的浏览器中呈现为一个简单的文本字段.在其他浏览器上它会正确呈现,就像在 iPhone 上一样,它会显示电子邮件键盘布局.
As I understand it, the <input type=email>
element in HTML5 will render as a simple text field in browsers that do not support the tag. On other browsers it will render properly, like on the iPhone it will bring up the e-mail keyboard layout.
我想在项目中使用它,但我的输入字段是
控件.如何使用 HTML5 元素,但仍像其他字段一样访问其数据服务器端?
I’d like to use this in a project but my input fields are <asp:TextBox>
controls. How can I use the HTML5 element but still access its data server-side like the rest of my fields?
推荐答案
.NET framework 4 的更新允许您指定类型属性
There is an update for .NET framework 4 which allows you to specify the type attribute
http://support.microsoft.com/kb/2468871.
在页面下方查看功能 3
功能 3
新语法让你定义一个HTML5 的 TextBox 控件兼容的.例如,以下代码定义了一个 TextBox 控件,它是兼容 HTML5:
New syntax lets you define a TextBox control that is HTML5 compatible. For example, the following code defines a TextBox control that is HTML5 compatible:
<asp:TextBox runat="server" type="some-HTML5-type" />
这篇关于如何在服务器端 .NET 中使用 HTML5 电子邮件输入类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!