iPhone / iPod(System.Web.UI.WebControls.TextBox)

时间:2011-08-23 22:30:15

标签: .net asp.net mobile textbox ios5

在我们的网络应用程序中,我们使用的是一个数字文本框,如下所示:

public class NumericTextBox : System.Web.UI.WebControls.TextBox
{
    class IgnoreTypeWriter : HtmlTextWriter
    {
        private HtmlTextWriter writer;
        public IgnoreTypeWriter(HtmlTextWriter writer)
            : base(writer)
        {
            this.writer = writer;
        }

        public override void AddAttribute(HtmlTextWriterAttribute attribute,
            string value)
        {
            if (attribute != HtmlTextWriterAttribute.Type)
            {
                writer.AddAttribute(attribute, value);
            }
        }
    };

    protected override void AddAttributesToRender(HtmlTextWriter writer)
    {
        IgnoreTypeWriter ignoreTypeWriter = new IgnoreTypeWriter(writer);
        base.AddAttributesToRender(ignoreTypeWriter);
        writer.AddAttribute(HtmlTextWriterAttribute.Type, "number");
    }
}

当我通过计算机打开网站时,我不能在文本框中输入超过10个字符。但是在我的iPod(iOS5)上,我可以继续永远进入。在另一部iPhone(iOS4)上,一切都运行良好。我不确定iOS5会有什么用呢!

标记看起来像这样:

<NumericTextBox ID="txtTransferAmountDetails" runat="server" 
    CssClass="currency font15" MaxLength="10" />

0 个答案:

没有答案