Must enter: Required Field Validator (C#) : Required Field « Validation by Control « ASP.Net






Must enter: Required Field Validator (C#)

<%@Page Language="C#"%>
<html>
<body>

<form runat="server">

<asp:textbox id="txtTest" text="delete this" runat="server" />

<asp:RequiredFieldValidator id="valRequired" runat="server"
     ErrorMessage="* You must enter a value in the text box"
     ControlToValidate="txtTest"
     Display="dynamic">
*
</asp:RequiredFieldValidator>

<br />

<asp:button text="Validate" runat="server" />

<asp:ValidationSummary id="valSummary" runat="server"
     HeaderText="<b>The following errors were found:</b>"
     ShowSummary="true"
     DisplayMode="List" />


</form>

</body>
</html>

           
       








Related examples in the same category

1.Checking Against an Initial Value with a RequiredFieldValidator Control (VB.net)
2.Required field validator (VB.net)
3.RequiredFieldValidator Demo: You must enter your name (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