In ASP.Net textbox, How i can restrict the user to enter maxlength. I should show message in label or message box, if user exceeding the maximum length.
I am using C# as code behind.:)
Printable View
In ASP.Net textbox, How i can restrict the user to enter maxlength. I should show message in label or message box, if user exceeding the maximum length.
I am using C# as code behind.:)
Try using asp:RegularExpressionValidator and some reger code to to satisfy your needs (http://regexlib.com)
I had asked about maxlength validation.. not for regular expression..!! thanks for response..
Before jumping into the conclusion, have you even explored the feasibility of using RegularExpressionValidator to fulfill your requirement!!
Takeout some time to read This article....
Hello,
Obviously, there is the MaxLength property of the TextBox which would stop the user from entering any more details:
http://msdn.microsoft.com/en-us/libr...maxlength.aspx
But you don't get any feedback as to what is going on. To get that, you could use something like jQuery to do this. Here are some examples:
http://docs.jquery.com/Plugins/Valid...hods/maxlength
http://keith-wood.name/maxlength.html
Hope that helps!
Gary