开发者

DropDownList and RequiredFieldValidator control

开发者 https://www.devze.com 2022-12-14 13:59 出处:网络
I am using dropdownlist control and a RequiredFieldValidator control for that ddlinside the gridview.

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"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号