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 mta?
What is the use of web.config and machine.config files?
What is the maximum amount of memory any single process on windows can address?
What is data reader in asp.net?
Why will you usually create an aspnet user account in the database for an asp.net web application?
How long the items in ViewState exists?
Securitywise What are the Enhancements in 2.0?
What is repository pattern in mvc.net? : asp.net mvc
What is difference between abstract class and an interface?
Define secured sockets layer.
How does the iis work?
Differentiate between Server.Transfer and Response.Redirect with functionality? Why we can choose one over the other?
Explain the differences between clr & cts?
What are the main requirements for caching?
Where the cookie value is stored?