带asp .net TextBox的iPhone电子邮件键盘布局 [英] iPhone email keyboard layout with asp .net TextBox

查看:42
本文介绍了带asp .net TextBox的iPhone电子邮件键盘布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您知道iDevices将如何根据type属性的HTML 5值显示不同的键盘布局吗?因此,<input type="email"...将显示iPad的电子邮件keboard布局.我正在使用.net TextBox,但希望iDevices为该字段显示适当的键盘布局.但是,当TextBox控件呈现时,type属性将覆盖为"text".有什么想法吗?

You know how the iDevices will display a different keyboard layout depending on the HTML 5 value of the type attribute? So, <input type="email"... will display the iPad's e-mail keboard layout. I am using a .net TextBox but would like to have the iDevices show the appropriate keyboard layout for the field. But the type attribute gets overridden to "text" when the TextBox control renders. Any ideas?

推荐答案

没有简单的解决方法,但是您可以创建一些新的控件,例如:

No easy fix, but you can create some new control like:

public EnhancedTextBox : TextBox {
     public Html5Type Html5Type { get; set; }

     override AddAttributesToRender(HtmlTextWriter writer) {
           // add attribute according to the selected type in the property
           // something like
           writer.AddAttribute("type", "email");
           base.AddAttributesToRender(writer);
     }
}

并使用它代替普通的TextBox

and use that instead of a normal TextBox

这篇关于带asp .net TextBox的iPhone电子邮件键盘布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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