CUSTOM VALIDATION
The CustomValidator control allows writing application specific custom validation routines for both the client side and the server side validation.
CustomValidator
1.Server Side
2.Client Side.
DEMO
i think useful this post.
The CustomValidator control allows writing application specific custom validation routines for both the client side and the server side validation.
CustomValidator
1.Server Side
2.Client Side.
DEMO
Html Coding
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table><tr><td>
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
</td><td>
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
<asp:CustomValidator ID="CustomValidator1"
runat="server"
ControlToValidate="TextBox1"
ErrorMessage="Available lenght is 5 "
OnServerValidate="CustomValidator1_ServerValidate">
</asp:CustomValidator>
</td>
<tr><td colspan="2">;
<asp:Button ID="Button1" runat="server" Text="Save" />
</td></tr>
</tr></table>
</div>
</form>
</body>
</html>
C# Coding
protected void CustomValidator1_ServerValidate(object sender, ServerValidateEventArgs e)
{
if (e.Value.Length == 5)
{
e.IsValid = true;
}
else
{
e.IsValid = false;
}
}
i think useful this post.
0 comments:
Post a Comment