I am using dropdownlist control and a RequiredFieldValidator control for that ddl inside the gridview.
<asp:DropDownList I开发者_JAVA百科D="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
ControlToValidate="ddlInsertRegion" in the validator but the DropDownList control ID is ID="ddlInsert"
精彩评论