i have a register form & in that form i have a 2 textboxes
for entering name&age.my doubt is that how can i provide
error message like "invalid entry" when user enter a
invalid name/age(eg:user enter name as #%%%##daff,and age
as 1000.)in that textboxes.I want code.
Answers were Sorted based on User's Feedback
Answer / saravanakumar
We can use RegularExpressionValidator to validate the textbox content.
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / rajeev kumar varshney
char[] SpecialChars = "#%".ToCharArray();
string text=TextBox1.Text;
int indexOf = text.IndexOfAny(SpecialChars);
if(indexOf != -1)
{
Page.ClientScript.RegisterStartupScript("this.getType(),"a","<script>alert('Please do not enter % or # in name');</script>");
}
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / satheshkumar
name textbox should follow the reqularexpersion valitator and age textbox should follow the range validator
Is This Answer Correct ? | 0 Yes | 0 No |
What you mean by partial Class in asp.net 2.0?
difference between Trace and Debug ?
2 Answers Accenture, HCL, Patni,
What is custom control. What is the difference between custom control and user control?
Write a code for sending an email from asp.net application.
How To Send Value one page to Another Page On MasterMenu Click ? please Tell Me!
Explain what benefit does your code receive if you decorate it with attributes demanding specific security permissions?
Is global asax mandatory?
What is the default timeout for a cookie?
What is a session in asp.net?
Explain how is a property designated as read-only?
What layout mode is the default when a new Web Form is created? a) GridBagLayout b) GridLayout c) FlowLayout d) FormLayout
What are the authentication types in asp.net?