Joma Alrzini

Joma Alrzini

  • NA
  • 61
  • 30.8k

display validation error for dropdownlist linked with DB

Jul 2 2016 10:42 AM
This the code I tried but the validation message not appeared  
 
<asp:DropDownList ID="DropDownList2" runat="server" EnableViewState="true" DataSourceID="SqlDataSource6" DataTextField="MName" DataValueField="MId" Width="130px" Height="25px"><asp:ListItem>Select ModuleID</asp:ListItem>
</asp:DropDownList>
<span runat="server" style="color:red; font-size:20px">*</span>
<asp:RequiredFieldValidator ErrorMessage="Module ID is a required field." id="RequiredFieldValidator3" ForeColor="Red" ControlToValidate="DropDownList2"
runat="server" ValidationGroup="click" />
<asp:SqlDataSource ID="SqlDataSource6" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [MId], [MName] FROM [Modules]"></asp:SqlDataSource>

Answers (1)