Tuesday, May 14, 2013

RequiredFieldValidator Control asp.net

RequiredFieldValidator Control

Evaluates the value of an input control to ensure that the user enters a value.

Syntax :

<asp:RequiredFieldValidator ID="req" runat="server" ControlToValidate="txt" ErrorMessage="Please Enter Required value" Display="Dynamic" ></asp:RequiredFieldValidator>


   ControlToValidate= "Control which have to validate"
    ErrorMessage ="Define custom error message
"  Display= "Error message display property :
                   Three types Dynamic,Static,None

Example :

Default.aspx :

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Required Field validator Example</title>
    <form id="form1" runat="server">
    Required Field validator Example
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <asp:RequiredFieldValidator ID="req" runat="server" ControlToValidate="txt" ErrorMessage="Please enter text box value" Display="Dynamic"></asp:RequiredFieldValidator>
        <asp:Button ID="Button1" runat="server" Text="Submit" CausesValidation="true"/>
RequiredFieldValidator Control asp.net</html>
Download Source code : RequiredFieldValidator Control asp.net

If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website