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.
Answer Posted / 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 |
Post New Answer View All Answers
Where the viewstate is stored after the page postback?
Explain exception handling in .net.
What is _viewstart?
What is xaml? Are xaml file compiled or built on runtime?
In your ASP.NET 2.0 web application you want to display an image that is selected from a collection of images. What approach will you use to implementing this?
How can we provide the WebParts control functionality to a server control?
What is x xss protection?
What is the use of HttpHandlers? When to use this?
What is the use of express session?
How you can stop the validation of ASP.NET controls from client side?
What is the difference between rest and restful?
How ViewstateMac works?
Define the steps to set up validation control.
What is the difference between application state and session state in asp net?
What is csrf attack in asp.net?