开发者

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

开发者 https://www.devze.com 2023-03-30 10:33 出处:网络
In our web application we are using a Numeric Text Box which is like this: public class NumericTextBox : System.Web.UI.WebControls.TextBox

In our web application we are using a Numeric Text Box which is like this:

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");
    }
}

When I open the website through my computer, I cannot enter more than 10 characters in the text box. However on my iPod (iOS5) I can just keep on entering forever. On another iPhone (iOS4) everything works fine as well. I am not sure what's up with iOS5!

The markup looks like this:

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号