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

What are the steps involved to fill a dataset?

0 Answers  


Differentiate between Server Transfer and Response Redirect?

2 Answers   DELL, Siebel, TCS,


how to include timer or counting time to display next page in asp.net

0 Answers  


How do you create a permanent cookie?

8 Answers   Siebel Systems,


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

3 Answers  






How to retrieve data row by row from a DataTable? Thanks In advance PriyaPP

3 Answers  


How many webforms are possible on a single webpage?

6 Answers  


Can i have both C# and vb.net code in same assembly?how?

5 Answers   Wipro,


Differentiate between namespace and assembly.

0 Answers  


how we use web services

2 Answers  


1.what is the application pool. 2.what is the HttpModile and Http Handler. 3.C# 3.0 Features ? 4.Anonoymous Type,methopd and claas in 3.0? 5.difference between statsic and const ? 6.session vs application 7.state management clint side and server side ? 8.Genric list 9.c# 3.0 vs 3.5

0 Answers   TCS,


Hi! Could any 1 please suggest me a free practice online exam for asp.net exams.. thanks

1 Answers  


Categories