Hi Friends, in this article I will explain about the
validation controls in ASP.NET and how to use the validation controls in
ASP.NET.
Validation server controls are used to validate user-input.
Validation controls are used to validate the input data, because if we didn't put
the validation to user input then it will display the error to the user.
In previous articles i explained some interview Questions on ASP.NET,VB.NET and SQL Server.
In previous articles i explained some interview Questions on ASP.NET,VB.NET and SQL Server.
Validation controls are two types
1. Client side validation controls
2. Server side validation controls
Client side validation controls:
Client side validation is good because the validations are
done at client side before going to the server. If an error is there then the
browser display the messages and doesn’t go to the server. It will decrease the
burden on the server.
For this we have to dependent on the scripting languages
like JavaScript, JQuery, VBscript etc.,
For
developer point of view serve side is preferable because it will not fail, it
is not dependent on browser and scripting language.
Server side validation controls:
An important point to create Asp.NET web page for the user,
we have to check all the user input.
Asp.Net provides a set of validation controls that provides
easy to use and but powerful way to check for errors and, if necessary, display
messages to the user.
There are
six types of validation controls in ASP.NET
- RequiredFieldValidation Control
- CompareValidator Control
- RangeValidator Control
- RegularExpressionValidator Control
- CustomValidator Control
- ValidationSummary
This control is used validate the control is not
empty.Suppose if user have to enter username then that situation we use the RequiredFieldValidation Control.
How to use this is shown below.
<div>
<asp:Label ID="Label1" runat="server" Text="Username"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Please enter Username"
ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
|
Copy and paste the above code, if use run the code and didn’t
enter username textbox and click the Button then it will display the error Please Enter Username .In this situation user have
to enter the username textbox otherwise it will not go to further.
We will discuss the other validation controls in the next
articles.
In the next article i explain about the ASP.NET Validation Controls with example | How to use ControlValidator in ASP.NET | ControlValidator Control in ASP.NET
in previous articles i explained about validation controls in ASP.NET and how to use the validation controls in ASP.NET.
CompareValidator in ASP.NET
CustomValidator Control, How to Validate with a Custom Function for ASP.NET Server Controls, ASP.NET CustomValidator Control.
RegularExpressionValidator for Email ID in ASP.NET or ASP.NET RegularExpressionValidator example.
ValidationSummary in ASP.NET
If you like my blog Aspdotnet-kishore then why are you waiting like my blog through facebook page Aspdotnet-kishore
In the next article i explain about the ASP.NET Validation Controls with example | How to use ControlValidator in ASP.NET | ControlValidator Control in ASP.NET
in previous articles i explained about validation controls in ASP.NET and how to use the validation controls in ASP.NET.
CompareValidator in ASP.NET
CustomValidator Control, How to Validate with a Custom Function for ASP.NET Server Controls, ASP.NET CustomValidator Control.
RegularExpressionValidator for Email ID in ASP.NET or ASP.NET RegularExpressionValidator example.
ValidationSummary in ASP.NET
If you like my blog Aspdotnet-kishore then why are you waiting like my blog through facebook page Aspdotnet-kishore
No comments:
Post a Comment