RequiredFieldValidator Demo: You must enter your name (VB.net) : Required Field « Validation by Control « ASP.Net






RequiredFieldValidator Demo: You must enter your name (VB.net)

<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<script runat=server>

</SCRIPT>
<HTML>
<HEAD>
<TITLE>RequiredFieldValidator Control Sample Page</TITLE>
</HEAD>
<BODY >
<form runat="server">
<Font Face="Tahoma">
<BR><BR>
<asp:Label
    id="lblMessage"
    runat="server"
    Font-Bold="True"
    Text="Name"
/>
<asp:TextBox 
    id="txtName" 
    Columns="25"
    MaxLength="30"
    runat=server 
    Text="Name"
/>
<asp:RequiredFieldValidator 
    id="rfvName"
    ControlToValidate="txtName"
    InitialValue="Name"
    Display="Dynamic"
    Font-Name="Verdana"
    Font-Size="10pt"
    runat=server
>
You must enter your name!
</asp:RequiredFieldValidator>
<BR><BR>
<asp:Label
    id="lblMessage2"
    runat="server"
    Font-Bold="True"
    Text="Name 2"
/>
<asp:TextBox 
    id="txtName2" 
    Columns="25"
    MaxLength="30"
    runat=server 
    Text="Name"
/>
<asp:RequiredFieldValidator 
    id="rfvName2"
    ControlToValidate="txtName2"
    InitialValue="Name"
    Display="Dynamic"
    Font-Name="Verdana"
    Font-Size="10pt"
    runat=server
>
You must replace name with your name!
</asp:RequiredFieldValidator>
<asp:RequiredFieldValidator 
    id="rfvName3"
    ControlToValidate="txtName2"
    Display="Dynamic"
    Font-Name="Verdana"
    Font-Size="10pt"
    runat=server
>
You must enter a name!
</asp:RequiredFieldValidator>
<BR><BR>
<asp:button 
    id="butOK"
    text="OK"
    Type="Submit"
    runat="server"
/>

</Font>
</Form>
</BODY>
</HTML>
           
       








Related examples in the same category

1.Must enter: Required Field Validator (C#)
2.Checking Against an Initial Value with a RequiredFieldValidator Control (VB.net)
3.Required field validator (VB.net)
4.Validation for aspText: cannot be empty, integer range (MaximumValue,MinimumValue) (VB.net)
5.DropDownList Must Have a Value Selected Other Than the Default