Sunday, 2 February 2014

Validation For Dropdownlist

 <div>
 
    <asp:DropDownList ID="dl" runat="server">
    <asp:ListItem Value="0">Select One Name</asp:ListItem>
    <asp:ListItem>Sandeep</asp:ListItem>
     <asp:ListItem>Pradeep</asp:ListItem>
      <asp:ListItem>Dinesh</asp:ListItem>
 
    </asp:DropDownList>
    <asp:RequiredFieldValidator ID="rf" runat="server" ErrorMessage="Select One Name"  ControlToValidate="dl" InitialValue="0"></asp:RequiredFieldValidator>
    </div>
    <div><asp:Button ID="btn" runat="server"  Text="submit" /></div>

No comments:

Post a Comment