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
Differentiate between a page theme and a global theme?
How will you do Redo and Undo in a TextControl?
What is cross page posting in asp net?
Is LINQ performance wise better or using sqlcommand?
How to use multiple scriptmanager controls in a web page?
What are session state modes in asp.net?
What is asp.net version?
What is the difference between mvc (model-view-controller) and mvp (model-view-presenter)? : asp.net mvc
What are session state modes? List some of the important session state modes of asp.net.
How to prepare culture-specific formatting in .net.
Name the namespace which is used by ado.net?
Explain how viewstate is being formed?
How long do session variables last?
What are the two Layouts supported by a Web form in ASP.NET?
How you can access the values from the Repeater control in ASP.NET?