我正在编写一个ASP.NET代码,用于根据性别改变最低结婚年龄。
<asp:Accordion ID="accSearchCategory" HeaderCssClass="accordionHeader"
HeaderSelectedCssClass="accordionHeaderSelected"
ContentCssClass="accordionContent" runat="server" SelectedIndex="0" FadeTransitions="true"
SuppressHeaderPostbacks="true" TransitionDuration="250" FramesPerSecond="40"
RequireOpenedPane="false" AutoSize="None">
<Panes>
<asp:AccordionPane ID="accPanSex" runat="server">
<Header>
Sex
</Header>
<Content>
<asp:UpdatePanel ID="updPanelSex" UpdateMode="Conditional" runat="server" >
<ContentTemplate>
<asp:DropDownList ID="ddlSex" runat="server" OnSelectedIndexChanged="ddlSex_SelectedIndexChanged" AutoPostBack="true">
<asp:ListItem Text="Male" Value="0"></asp:ListItem>
<asp:ListItem Text="Female" Value="1"></asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</Content>
</asp:AccordionPane>
<asp:AccordionPane ID="accPanMaritalStatus" runat="server">
<Header>
Marital Status
</Header>
<Content>
<asp:UpdatePanel ID="updPanelMaritalStatus" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlMaritalStatus" runat="server">
<asp:ListItem Text="Single" Value="0"></asp:ListItem>
<asp:ListItem Text="Divorced" Value="1"></asp:ListItem>
<asp:ListItem Text="Separated" Value="2"></asp:ListItem>
<asp:ListItem Text="Widowed" Value="3"></asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
<Triggers></Triggers>
</asp:UpdatePanel>
</Content>
</asp:AccordionPane>
<asp:AccordionPane ID="accPanAge" runat="server">
<Header>
Age
</Header>
<Content>
<table>
<tr>
<td>From
</td>
<td>
<asp:UpdatePanel ID="updPanelFromAge" UpdateMode="Conditional" runat="server" ChildrenAsTriggers="false">
<ContentTemplate>
<asp:TextBox ID="txtFromAge" runat="server" OnTextChanged="txtFromAge_TextChanged" AutoPostBack="true"></asp:TextBox>
<asp:SliderExtender ID="txtFromAge_SliderExtender" runat="server" Maximum="49" Minimum="18"
BoundControlID="txtShowFromAge" TargetControlID="txtFromAge">
</asp:SliderExtender>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlSex" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
<td> </td>
<td>
<asp:UpdatePanel ID="updPanelShowFromAge" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtShowFromAge" runat="server" CssClass="form-text inline" Width="50px"
></asp:TextBox>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlSex" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td>To
</td>
<td>
<asp:UpdatePanel ID="updPanelToAge" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtToAge" runat="server"></asp:TextBox>
<asp:SliderExtender ID="txtToAge_SliderExtender" runat="server" Maximum="50" Minimum="19"
BoundControlID="txtShowToAge" TargetControlID="txtToAge">
</asp:SliderExtender>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtFromAge" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
<td> </td>
<td>
<asp:UpdatePanel ID="updPanelShowToAge" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:TextBox ID="txtShowToAge" runat="server" CssClass="form-text inline" Width="50px"></asp:TextBox>
years
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtFromAge" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
</table>
</Content>
</asp:AccordionPane>
<asp:AccordionPane ID="accPanLocatedIn" runat="server">
<Header>
Located in
</Header>
<Content>
<asp:UpdatePanel ID="updPanelLocation" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlBirthState" runat="server"
</asp:DropDownList>
</ContentTemplate>
<Triggers></Triggers>
</asp:UpdatePanel>
</Content>
</asp:AccordionPane>
</Panes>
</asp:Accordion>
正如您所见,updPanelSex有ddlSex,但是我收到错误。
我知道它的可访问性问题,但似乎没有任何效果。