Reputation: 199
I am using dropdownlist control and a RequiredFieldValidator control for that ddl inside the gridview.
<asp:DropDownList ID="ddlInsert" runat="server" CssClass="normal" DataSourceID="sqlDataSource" DataTextField="Name" DataValueField="ID" SelectedValue='<%# Bind("ID") %>' AppendDataBoundItems="true">
<asp:ListItem Text="--Select--" Value="-1" Selected="True" />
</asp:DropDownList>
<asp:RequiredFieldValidator ID="requiredDDL" runat="server" ControlToValidate="ddlInsertRegion" ErrorMessage="*" InitialValue="-1" Display="Dynamic"></asp:RequiredFieldValidator>
But this validator is not working
Upvotes: 1
Views: 5332
Reputation: 767
ControlToValidate="ddlInsertRegion" in the validator but the DropDownList control ID is ID="ddlInsert"
Upvotes: 2