我在带有必填字段验证器的 ASP.NET 页面上有一个控件。唯一的问题是,当我通过页面按钮更改页面时,它不会导致验证。代码如下,谁能看看有什么问题?
<asp:Label ID="lblD_Year" runat="server" BorderStyle="None"
Text="Fiscal Year" CssClass="h2"></asp:Label>
<asp:DropDownList ID="ddlD_Year" runat="server" Width="100px" TabIndex="8"
AutoPostBack="True" CssClass="box" CausesValidation="True">
<asp:ListItem Value="0" Selected="True">Select Year</asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvD_Year" runat="server"
ControlToValidate="ddlD_Year" Display="Dynamic" ErrorMessage="*"
Font-Bold="True" ForeColor="Red" InitialValue="Select Year"
SetFocusOnError="True"></asp:RequiredFieldValidator>