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
What is view state management in asp net?
What is special types forms
How Session outproc in Sqlserver stored?
What are the disadvantages of view state?
Are cookies client side or server side?
What is asp.net and its advantages?
To display data in the combo box, prior to setting the Data Source, what kind of property on a Combo Box do you set with a column name?
What is authentication in asp.net?
What's the difference between viewstate and sessionstate?
What does postback mean?
What is the purpose of master page?
How can you implement the postback property of an asp.net control?
In which event of the page viewstate is available?
How does asp.net work?
Why is global asax is used?