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
Explain server-side scripting?
How many web config files can be created for an application?
To get the values in two different controls to match which control you use it?
Let's say I have an existing application written using vb6 and this application utilizes windows 2000 com+ transaction services. How would you approach migrating this application to.net?
What will happen if the server confugration file and the application confugration file have different values for sassion state ASP.NET?
Why is the standalone environment only useful during the development process?
Is asp.net web forms dead?
Which property is used to identify the Page is Post Back in ASP.NET?
Demonstrate Render and PreRender?
Write a code for sending an email from asp.net application.
Which method is used to force all the validation controls to run?
What is http request and response?
What is the difference between typeof() vs gettype()?
Types of instancing properties and explain each. Tell the difference between multiuse,singleuse and globalmultiuse and which is default ?
Explain different types of validators in asp.net?