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 the difference between adding reference in solution explorer and adding references by using ?
How Session outproc in Sqlserver stored?
How ASP.NET page works?
What is state management react?
What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
Briefly describe the role of global.asax?
Is session server side or client side?
What is a web api? Which protocol is used in a web api?
In Code-Behind class which kind of code (server or client) is found ?
How do you declare static variable?
Explain about ASP.NET?
Explain the difference between inline and code behind - which is best in?
How many types of validation are there?
What are the different methods of session maintenance in asp.net?
How does session state work in asp.net?