0
我有一個下拉列表(asp.net),當用戶更改選擇,我想基於從下拉列表中選擇顯示div。Jquery:基於從DropDownList的選擇顯示div
我這裏有代碼...
<asp:DropDownList ID="ddlFilter" runat="server" Width="221px">
<asp:ListItem Text="Select..." Value=""></asp:ListItem>
<asp:ListItem Text="Date" Value="DATE"></asp:ListItem>
<asp:ListItem Text="Subject" Value="SUBJECT"></asp:ListItem>
<asp:ListItem Text="Status" Value="STATUS"></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnSearch" Text="Search" runat="server" />
<div id="divDateRangeSearch">
<div style="float: left">
<asp:Label ID="lblDateRange" runat="server" Text="Date Range"></asp:Label>
<br />
<uc1:DatePicker ID="FromDate" runat="server" />
<uc1:DatePicker ID="ToDate" runat="server" />
</div>
</div>
<div id="divSearchSubject" >
<div style="float: left">
<asp:Label ID="lblSubject" runat="server" Text="Subject"></asp:Label><br />
<asp:TextBox ID="txtSubject" runat="server" Width="225px"></asp:TextBox>
</div>
</div>
<div id="divStatusSearch">
<div style="float: left">
<asp:Label ID="lblStatus" runat="server" Text="Status" ></asp:Label>
<br />
<asp:DropDownList ID="ddStatus" runat="server" Width="152px" >
</asp:DropDownList>
</div>
</div>
更新時間:
<div style="width: 880px; padding-top: 2px; border-bottom: none;
height: 28px;">
<asp:Label ID="lblFilterResultsBy" runat="server" Text="Filter Results by:"></asp:Label>
<asp:DropDownList ID="ddlFilter" runat="server" Width="221px">
<asp:ListItem Text="Select..." Value=""></asp:ListItem>
<asp:ListItem Text="Date" Value="DATE"></asp:ListItem>
<asp:ListItem Text="Subject" Value="SUBJECT"></asp:ListItem>
<asp:ListItem Text="Status" Value="STATUS"></asp:ListItem>
</asp:DropDownList>
<div id="div_date" style="width:250px; display:none; " class="sectionrowDate">
<div style="float: left">
<asp:Label ID="lblDateRange" runat="server" Text="Date Range" ></asp:Label>
<br />
<uc1:DatePicker ID="FromDate" runat="server" />
<uc1:DatePicker ID="ToDate" runat="server" />
</div>
</div>
<asp:Button ID="btnSearch" Text="Search" runat="server" />
你怎麼躲?我嘗試這樣做:( '#div_date')隱藏()但不起作用。 – 2010-07-23 19:43:15
不工作show()方法,我調試代碼及其執行.show()和.hide(),但我沒有看到任何改變在屏幕上,任何想法? – 2010-07-23 19:56:05
檢查你的ID ..如果他們是正確的,隱藏和顯示應該工作。也檢查是否條件滿足是否正確 – 2010-07-23 19:57:05