Javascript 如何使用asp.net c访问multiselect dropdownlist
我有一个多选下拉列表,如下所示:Javascript 如何使用asp.net c访问multiselect dropdownlist,javascript,c#,asp.net,Javascript,C#,Asp.net,我有一个多选下拉列表,如下所示: <select id="ddMonths" multiple="multiple"> <option value="oneM" selected="selected"> OneMonth</option> <option value="twoM" selected="selected">TwoMonths</option> <option value="threM"
<select id="ddMonths" multiple="multiple">
<option value="oneM" selected="selected"> OneMonth</option>
<option value="twoM" selected="selected">TwoMonths</option>
<option value="threM" selected="selected">ThreMonths</option>
<option value="fourM" selected="selected">FourMonths</option>
<option value="fiveM" selected="selected">FiveMonths</option>
<option value="SixM" selected="selected">SixMonths</option>
</select>
<table>
<thead>
<tr>
<th >Something</th>
<th>Something1</th>
<th>Something2 </th>
<th >Something3 </th>
<th>Something4 </th>
</tr>
</thead>
<tbody id="trBoth">
<asp:Literal ID="allSomething" runat="server"></asp:Literal>
</tbody>
</table>
我有一个如下的html表:
<select id="ddMonths" multiple="multiple">
<option value="oneM" selected="selected"> OneMonth</option>
<option value="twoM" selected="selected">TwoMonths</option>
<option value="threM" selected="selected">ThreMonths</option>
<option value="fourM" selected="selected">FourMonths</option>
<option value="fiveM" selected="selected">FiveMonths</option>
<option value="SixM" selected="selected">SixMonths</option>
</select>
<table>
<thead>
<tr>
<th >Something</th>
<th>Something1</th>
<th>Something2 </th>
<th >Something3 </th>
<th>Something4 </th>
</tr>
</thead>
<tbody id="trBoth">
<asp:Literal ID="allSomething" runat="server"></asp:Literal>
</tbody>
</table>
我使用代码隐藏中的文字填充表。
我想使用multiselect dropdownlist中的选定项来控制表的值是否可能???如何从代码隐藏中访问所选项目?我正在使用asp.net C。我需要您的帮助。我希望在这种情况下避免使用DropDownList和使用ListBox
查看ListBox控件以允许多重选择
<asp:ListBox runat="server" ID="lblMultiSelect" SelectionMode="multiple">
<asp:ListItem Text="One" Value="OneM" />
<asp:ListItem Text="Two" Value="TwoM" />
<asp:ListItem Text="Three" Value="ThreeM" />
</asp:ListBox>
否则使用复选框进行下拉
我不需要一个列表框我需要一个多复选框下拉列表。。。还有其他方法吗???谢谢你的帮助,如果列表框没有选择任何元素,我还有另一个问题要用javascript检查。如果没有选择任何元素,我不会隐藏表格。我没有使用第一个函数:$document.ready函数{$'[id*=lblmultisselect]'.multiselect{includecelloption:false,};}@IAnnatetius如果列表框中未选择任何元素,则需要隐藏表格?当发生这种情况时..在单击按钮或页面加载时?同时显示表格的代码和allon page load表格是相同的,我只是输入id,当所选项目为none时,我不会隐藏表格$'table'。隐藏@伊安纳提乌斯你想什么时候把桌子藏起来?我知道如果没有选择任何项目,它需要隐藏,但请告诉我事件..是按钮单击还是其他..同时告诉我您在上面列出时使用了哪个控件