Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are session state modes in asp.net?

950


How do you declare delegates and are delegates and events one and the same and explain how do you declare delegates and invoke them ?

4137


What are the best practices to follow to secure connection strings in an ASP.NET web application?

1009


What is & in a url?

902


Define page fragment caching?

867


Which type of state management is provided by Query String in ASP.NET?

965


How can you dynamically add user controls to a page?

899


What are custom user controls in asp.net?

966


Explain about asp.net caching?

982


How do I open an ashx file?

1007


List the events in page life cycle.

915


Explain how to prepare culture-specific formatting in .net.

925


Why will you usually create an aspnet user account in the database for an asp.net web application?

965


How do we sort the data from a dataset?

912


What is webresource axd?

828