这让我疯狂了两天。我有一个带下拉菜单的aspx页面。每个下拉列表都会根据其他下拉列表选择动态更改。代码是
<asp:UpdatePanel id="UpdatePanel1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="panel panel-gray">
<div class="panel-heading">Filter Configuration</div>
<div class="panel-body">
<asp:DropDownCheckBoxes ID="DdlProject" runat="server" OnTextChanged="DdlProject_TextChanged"
AddJQueryReference="true" AutoPostBack="true" OnSelectedIndexChanged="DdlProject_SelectedIndexChanged" >
<Style SelectBoxWidth="165" DropDownBoxBoxWidth="165" DropDownBoxBoxHeight="240" DropDownBoxCssClass="btn-default dropdown-toggle box-height" SelectBoxCssClass="btn-default dropdown-toggle text-bold"/>
<Texts SelectBoxCaption="Project" />
</asp:DropDownCheckBoxes>
</div>
</div>
<div class="panel panel-gray" style="margin-top: 30px">
<div class="panel-heading">Additional Parameters</div>
<div class="panel-body">
<ul class="nav nav-tabs nav-justified">
<li role="presentation" id="users-btn" onclick="showUsersDiv()" class="active"><a href="#">Users</a></li>
<li role="presentation" id="powertrain-btn" onclick="showPowerTrainDiv()"><a href="#">Powertrain</a></li>
</ul>
<div id="users" class="additional-param">
<asp:DropDownCheckBoxes ID="DdlOperator" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlOperator_SelectedIndexChanged" >
<Style SelectBoxWidth="200" DropDownBoxBoxWidth="200" DropDownBoxBoxHeight="200" DropDownBoxCssClass="btn-default dropdown-toggle" SelectBoxCssClass="btn-default dropdown-toggle text-bold"/>
<Texts SelectBoxCaption="Operator" />
</asp:DropDownCheckBoxes>
</div>
<div id="powertrain" class="additional-param" style="display: none;">
<asp:DropDownCheckBoxes ID="DdlEngine" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlEngine_SelectedIndexChanged" >
<Style SelectBoxWidth="150" DropDownBoxBoxWidth="150" DropDownBoxBoxHeight="200" DropDownBoxCssClass="btn-default dropdown-toggle" SelectBoxCssClass="btn-default dropdown-toggle text-bold"/>
<Texts SelectBoxCaption="Engine"/>
</asp:DropDownCheckBoxes>
</div>
</div>
</div>
</ContentTemplate>
导航标签的Javascript
function showUsersDiv() {
$("#users").show();
$("#powertrain").hide();
$("#dyno").hide();
$("#hex").hide();
resetActiveParamButtons();
$("#users-btn").addClass("active");
}
function showPowerTrainDiv() {
$("#users").hide();
$("#powertrain").show();
$("#dyno").hide();
$("#hex").hide();
resetActiveParamButtons();
$("#powertrain-btn").addClass("active");
}
在updatePanel中我放置了两个引导板一个面板几个下拉列表。另一个面板有导航标签。每个导航标签都有下拉菜单。两个面板的所有这些下拉都取决于彼此的选择。所以我不能将这两个面板放在不同的UpdatePanel中。无论我选择哪个选项卡,回发后都会重置为“用户”选项卡。我怎样才能做到这一点。任何帮助赞赏。谢谢