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.

Answers were Sorted based on User's Feedback



i have a register form & in that form i have a 2 textboxes for entering name&age.my doubt ..

Answer / saravanakumar

We can use RegularExpressionValidator to validate the textbox content.

Is This Answer Correct ?    2 Yes 0 No

i have a register form & in that form i have a 2 textboxes for entering name&age.my doubt ..

Answer / 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

i have a register form & in that form i have a 2 textboxes for entering name&age.my doubt ..

Answer / satheshkumar

name textbox should follow the reqularexpersion valitator and age textbox should follow the range validator

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

Difference between Dataset and DataReader ?

4 Answers   Accenture, BirlaSoft, Infosys, Microsoft, Techseol,


What are asynchronous callbacks ?

6 Answers   Accenture, BirlaSoft,


What are the different types of validation controls provided in ASP.NET?

0 Answers   Sans Pareil IT Services,


How can you handle exceptions in asp.net?

0 Answers  


What is master page in dtp?

0 Answers  






Suppose you want a certain ASP.NET function executed on MouseOver over a certain button. Where do you add an event handler?

1 Answers   Zenith,


what is state management?

2 Answers  


Explain Factory pattern?

2 Answers   Microsoft,


When working with ASP.Net server controls, it is important to use the right event handlers to capture the event for the application to function properly. What event would you use to capture the selection of a new item in a DropDownList control? a) The Click event. b) The SelectionChanged event. c) The SelectionIndexChanged event. d) The ChangedSelection event.

4 Answers   Syntax Softtech,


is it possible to set more than web.config file for an ASP.net APPLICATION?can it run?how is it possible

3 Answers  


What is clickid?

0 Answers  


Are cookies stored on server or client?

0 Answers  


Categories