How to validate textbox with default value

            <asp:TextBox ID="txtEmail" Height="43px" runat="server" Text="Email" OnFocus="ClearText(this)" onfocusout="ResetText(this)" ForeColor="#333333" ></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Display="Dynamic" ControlToValidate="txtEmail" InitialValue="Email" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>

In your RequiredFieldValidator have a InitialValue Property, You have enter the default value of your textbox value. Thats it.

No comments:

Post a Comment