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
Why session is necessary in web application?
What do you mean by authorization?
Can more than one person use the same login?
Explain the difference between dataset and datareader.
How to use ipostback?
Write code to send e-mail from an asp.net application?
To bind columns manually which tags do you need to add within the asp:datagrid ?
In a webservice, need to display 10 rows from a table. Which is the best choice among datareader or dataset?
Where the assembly is stored in asp.net?
Explain cookies with example.
What is the benefit of WebAPI over WCF?
Describe the differences between the lifecycles of Windows services and Standard EXE?
What is difference between session and cookies in asp net?
How can you identify that the page is post back?
How can we prevent browser from caching an aspx page?