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 |
Can we set which type of comparison we want to perform by the CompareValidator control?
which directive is mandatory in page control
what is the generics and where used generics in your project?
What are clr?cts?cls?
4 Answers e4e, HCL, Microsoft, Tata Communications,
Which is the parent class of the ASP.NET server control?
0 Answers Sans Pareil IT Services,
What is the use of web.config file?
Explain how inline and code behind is used differently ?
If I m using Session State Partioning where I have partitioned my session into 4 servers then how can I know that my session will be stored on which server?
How can we access static variable?
What is the difference between application object and session object?
What is difference b/w Data Grid in ASP.Net 1.1 and Gridview in 2.0
What are skins?