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 are session state modes in asp.net?
How do you declare delegates and are delegates and events one and the same and explain how do you declare delegates and invoke them ?
What are the best practices to follow to secure connection strings in an ASP.NET web application?
What is & in a url?
Define page fragment caching?
Which type of state management is provided by Query String in ASP.NET?
How can you dynamically add user controls to a page?
What are custom user controls in asp.net?
Explain about asp.net caching?
How do I open an ashx file?
List the events in page life cycle.
Explain how to prepare culture-specific formatting in .net.
Why will you usually create an aspnet user account in the database for an asp.net web application?
How do we sort the data from a dataset?
What is webresource axd?