UpdatePanels和DropDownLists

时间:2009-08-13 13:31:42

标签: asp.net updatepanel

我有六个DropDownLists成对排列名称和密钥。它们的运作方式是您选择渠道合作伙伴,然后筛选并重新绑定总部等等。

到目前为止它工作正常,但我希望能够拥有它,以便每对DropDownLists由上面的那些触发。我该怎么做?

我已经考虑并尝试使用UpdatePanel包装最后两对,以便只触发那些。但是运气不好。任何帮助将不胜感激:)

到目前为止的代码是:

<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>

2 个答案:

答案 0 :(得分:1)

  1. 与AJAX Control Toolkit中的Cascading DropDown相比,可以很好地实现相同的问题。好吧可能不是你的方式。
  2. 将对放在单独的UpdatePanels

答案 1 :(得分:0)

您是否在AjaxControlToolkit中看到了CascadingDropDown?我认为这会做很多你想要的事情。