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

Where the viewstate is stored after the page postback?

1066


Explain exception handling in .net.

1073


What is _viewstart?

910


What is xaml? Are xaml file compiled or built on runtime?

973


In your ASP.NET 2.0 web application you want to display an image that is selected from a collection of images. What approach will you use to implementing this?

989


How can we provide the WebParts control functionality to a server control?

998


What is x xss protection?

980


What is the use of HttpHandlers? When to use this?

1111


What is the use of express session?

984


How you can stop the validation of ASP.NET controls from client side?

1039


What is the difference between rest and restful?

1053


How ViewstateMac works?

2832


Define the steps to set up validation control.

1041


What is the difference between application state and session state in asp net?

1054


What is csrf attack in asp.net?

1025