简体   繁体   English

在Internet Explorer Metro上的asp:textbox强制数字小键盘

[英]asp:textbox force numeric keypad on Internet Explorer Metro

On a touchscreen PC, when using the Metro Internet explorer, 在触摸屏PC上,使用Metro Internet Explorer时,

Is there any way to force the numeric keypad to open first when the focus is put on an asp:Testbox control ? 将焦点放在asp:Testbox控件上时,是否有任何方法可以强制数字键盘先打开?

<asp:TextBox ID="txtBadge" runat="server" MaxLength="9" style="width: 100px; height: 30px; font-size: 16pt;" TabIndex="1"></asp:TextBox>

Its a number only textbox and having the normal keyboard pop up when its selected is annoying for users as it slows them down. 它是一个只有数字的文本框,当选中它时会弹出普通键盘,这对用户来说很烦,因为它会使用户放慢速度。

So instead of this : 所以代替这个: 初始触摸键盘

Id like this to show: 想要显示以下内容: 数字键和符号键盘

Assuming IE10/Metro follows the standard approach, you need an HTML5 <input type="number"... in your output. 假设IE10 / Metro遵循标准方法,则在输出中需要HTML5 <input type="number"... If you're using .NET 4.5, you can just set TextMode="Number" on your TextBox : 如果您使用的是.NET 4.5,则可以在TextBox上设置TextMode="Number"

<asp:TextBox ID="txtBadge" runat="server" TextMode="Number" ...

If you're using .NET 4.0, there's an update which will let you specify the type attribute: 如果您使用的是.NET 4.0,则可以通过更新来指定type属性:

<asp:TextBox ID="txtBadge" runat="server" type="number" ...

If you're using .NET 3.5 or earlier, the HTML5 input types are not supported by the built-in controls. 如果您使用的是.NET 3.5或更早版本,则内置控件不支持HTML5输入类型。 You'll need to write a custom control to support them. 您需要编写一个自定义控件来支持它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM