更新面板和下拉列表
我有六个 DropDownList,按名称和键对排列。他们的运作方式是,您选择一个渠道合作伙伴,然后过滤并重新绑定总部等等。
到目前为止它工作正常,但我希望能够拥有它,以便每对 DropDownList 都由上面的 DropDownList 触发。我该怎么做?
我考虑过并尝试用 UpdatePanels 包装最后两对,以便只有那些会被触发。但没有太多运气。任何帮助将不胜感激:)
到目前为止的代码是:
<table>
<tr id="trCP" runat="server">
<td>Channel Partners</td>
<td><asp:DropDownList ID="ddlChannelPartners" runat="server" AutoPostBack="True" CssClass="name" OnSelectedIndexChanged="ddlChannelPartners_SelectedIndexChanged" /></td>
<td><asp:DropDownList ID="ddlChannelPartnersKey" runat="server" AutoPostBack="True" CssClass="code" OnSelectedIndexChanged="ddlChannelPartnersKey_SelectedIndexChanged" /></td>
</tr>
<tr>
<td>Head Companys</td>
<td><asp:DropDownList ID="ddlHeadCompanies" runat="server" AutoPostBack="True" CssClass="name" OnSelectedIndexChanged="ddlHeadCompanies_SelectedIndexChanged" /></td>
<td><asp:DropDownList ID="ddlHeadCompaniesKey" runat="server" AutoPostBack="True" CssClass="code" OnSelectedIndexChanged="ddlHeadCompaniesKey_SelectedIndexChanged" /></td>
</tr>
<tr>
<td>Clients</td>
<td><asp:DropDownList ID="ddlClients" runat="server" AutoPostBack="True" CssClass="name" OnSelectedIndexChanged="ddlClients_SelectedIndexChanged" /></td>
<td><asp:DropDownList ID="ddlClientsKey" runat="server" AutoPostBack="True" CssClass="code" OnSelectedIndexChanged="ddlClientsKey_SelectedIndexChanged" /></td>
</tr>
<tr>
<td colspan="3">
<asp:Button ID="btnOK" runat="server" UseSubmitBehavior="true" Text="OK" OnClick="btnOK_Click" />
</td>
</tr>
</table>
I have six DropDownLists arranged in pairs Name and Key. They operate in the sense of you choose a Channel Partner and then that filters down and rebinds the Head Office and so forth.
It works fine so far but I want to be able to have it so that each pair of DropDownLists are triggered by the ones above. How would I do this?
I have thought about and tried wrapping the last two pairs with UpdatePanels so that only those would be triggered. But haven't had much luck. Any help would be greatly appreciated :)
the code so far is:
<table>
<tr id="trCP" runat="server">
<td>Channel Partners</td>
<td><asp:DropDownList ID="ddlChannelPartners" runat="server" AutoPostBack="True" CssClass="name" OnSelectedIndexChanged="ddlChannelPartners_SelectedIndexChanged" /></td>
<td><asp:DropDownList ID="ddlChannelPartnersKey" runat="server" AutoPostBack="True" CssClass="code" OnSelectedIndexChanged="ddlChannelPartnersKey_SelectedIndexChanged" /></td>
</tr>
<tr>
<td>Head Companys</td>
<td><asp:DropDownList ID="ddlHeadCompanies" runat="server" AutoPostBack="True" CssClass="name" OnSelectedIndexChanged="ddlHeadCompanies_SelectedIndexChanged" /></td>
<td><asp:DropDownList ID="ddlHeadCompaniesKey" runat="server" AutoPostBack="True" CssClass="code" OnSelectedIndexChanged="ddlHeadCompaniesKey_SelectedIndexChanged" /></td>
</tr>
<tr>
<td>Clients</td>
<td><asp:DropDownList ID="ddlClients" runat="server" AutoPostBack="True" CssClass="name" OnSelectedIndexChanged="ddlClients_SelectedIndexChanged" /></td>
<td><asp:DropDownList ID="ddlClientsKey" runat="server" AutoPostBack="True" CssClass="code" OnSelectedIndexChanged="ddlClientsKey_SelectedIndexChanged" /></td>
</tr>
<tr>
<td colspan="3">
<asp:Button ID="btnOK" runat="server" UseSubmitBehavior="true" Text="OK" OnClick="btnOK_Click" />
</td>
</tr>
</table>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您见过 AjaxControlToolkit 中的 CascadingDropDown 吗?我认为这会做很多你想要的事情。
Have you seen the CascadingDropDown in the AjaxControlToolkit? I think that'll do a lot of what you want.