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 is the difference between adding reference in solution explorer and adding references by using ?

1087


How Session outproc in Sqlserver stored?

2760


How ASP.NET page works?

1100


What is state management react?

1038


What ports must be open for DCOM over a firewall? What is the purpose of Port 135?

2372


Briefly describe the role of global.asax?

992


Is session server side or client side?

965


What is a web api? Which protocol is used in a web api?

1074


In Code-Behind class which kind of code (server or client) is found ?

1062


How do you declare static variable?

1040


Explain about ASP.NET?

1091


Explain the difference between inline and code behind - which is best in?

1012


How many types of validation are there?

968


What are the different methods of session maintenance in asp.net?

1026


How does session state work in asp.net?

1033