C# – DropDownList and RequiredFieldValidator control

asp.net-3.5c++drop-down-menu

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

Best Solution

ControlToValidate="ddlInsertRegion" in the validator but the DropDownList control ID is ID="ddlInsert"