Norque Norque - 1 year ago 117
ASP.NET (C#) Question

Can you Format input from a text box in C# without a masked text box?

I need to format many text boxes in my C# web application some to accept 13 numbers some to accept 10 numbers and some to accept a combination like "IS112" I haven't been able to find anything that wasnt a masked text box using AJAX Extensions and am just checking to see if there is any way before I have to add the extension and remake and ID my text boxes.

Answer Source
<asp:TextBox ID="txtBox" runat="server" MaxLength="13"></asp:TextBox>
This is a text Box
 <asp:RegularExpressionValidator ID="RegularExpressionValidator1"runat="server" ControlToValidate="txtBox"
ValidationExpression="^(\d{0,13})$" ErrorMessage="*Invalid Text Length:" text="*" Display="Dynamic" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download