Click here to Skip to main content
15,662,426 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I want to validate the text box,the user only enter Combination of char,wild chard and integer and values is not more then 10 digit no .how we validate the text box which type validation we used..?

Arvind kumar Singh
Updated 13-Apr-11 2:05am
Tarun.K.S 13-Apr-11 8:05am    
Its still unclear, could explain it with a sample example?
Oshtri Deka 13-Apr-11 8:42am    
Please restructure your sentence, it's a bit confusing ("...and values is not more then 10 digit no..."?!?).
Do you want max length of string to be 10 or to allow input of 10 digits at most?

Share this answer
if you simply wants to restrict number of characters Or digit not more than 10

you can try this

<asp:TextBox ID="TextBox1" MaxLength="10" runat="server"></asp:TextBox>
Share this answer
I didn't realize ASP.Net tag! I'm sorry!:(

Limiting maximum length of string is simple, go to Properties Window and look for MaxLength property
myTextBox.MaxLength = 10; 

At most of times I check my input on KeyPress event.

myTextBox.KeyPress += delegate(object sender, KeyPressEventArgs e)
    if (!IsMyCharOk(e.KeyChar))
        //unwanted values are handled B)
        e.Handled = true;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900