How to validate a TextBox that it should not accept null values?

 Posted by vishalneeraj-24503 on 5/6/2014 | Category: ASP.NET Interview questions | Views: 2092 | Points: 40
Answer:

The RequiredFieldValidator control is introduced in Dot Net 1.0 and is a validation control used to make an input control a required field.

For Example:-
<asp:TextBox runat = "server" Id = "txt_name" />

<asp:RequiredFieldValidator runat="server" Id="req_name" ControlToValidate = "txt_name" ErrorMessage = "Text box can not be empty" />


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response