级联下拉问题 [英] cascading dropdown problem

查看:49
本文介绍了级联下拉问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个级联的下拉列表.当您从第一个ddl中选择一个项目时,第二个ddl将被填充正确的列表.问题是,当您从第二个ddl中选择一个项目时,它始终显示列表中的第一个项目,而没有填充第三个ddl.没有ajaxtoolkit的情况下我该如何解决?

OP更新:
这是代码

Hi,
I have a cascading dropdownlists. When you select an item from the first ddl, the 2nd ddl gets populated with the correct list. The problem is when you select an item from the 2nd ddl, it always shows the first item on the list and it does not populate the 3rd ddl. How can I solve this without ajaxtoolkit?

UPDATE by OP:
here is the code

<form id="Form1" method="post" runat="server">
  <asp:ScriptManager ID="ScriptManager" runat="server" />
    <asp:UpdatePanel ID="Panel1" runat="server" ChildrenAsTriggers="true">
    <ContentTemplate>
        <asp:DropDownList ID="cbCL" runat="server" Width="209px" AutoPostBack="true" OnSelectedIndexChanged="SetShip" ></asp:DropDownList>
        <asp:DropDownList ID="cbShip" runat="server" Width="209px" AutoPostBack="true" OnSelectedIndexChanged="SetPort" ></asp:DropDownList>
        <asp:DropDownList ID="cbPort" runat="server" Width="209px" AutoPostBack="true" ></asp:DropDownList>
        <asp:DropDownList ID="cbMerchant" runat="server" Width="209px" ></asp:DropDownList>
    </ContentTemplate>
    </asp:UpdatePanel>
</form>





Public Sub SetShip(ByVal sender As Object, ByVal e As System.EventArgs)
         Common.BindShipByCL(cbShip, cbCL.SelectedItem.Value, Date.Today)
  End Sub
  Public Sub SetPort(ByVal sender As Object, ByVal e As System.EventArgs)
     Common.BindPortByShip(cbPort, cbShip.SelectedItem.Value, Date.Today)   
  End Sub



谢谢,
Martin



Thanks,
Martin

推荐答案

如果看到代码,您会发现级联下拉列表存在于单个更新面板中,因此所有基于任何一个的回发都将刷新.

当然,在拾取第二个下拉值以填充第三个下拉值之前,该丢失了,因此什么也没有发生.
只需使用DEBUGGER,它就可以告诉您执行的过程.此外,如果您错过了使用Page.IsPostback & ScriptManager.IsInAsyncPostBack页面属性然后应用它们,以便在触发onchange事件之前不会重新填充下拉列表.
If you see the code, you will find that the cascading dropdowns are present in a single update panel and thus all will get refreshed based on postback of any one.

Surely, before picking up the second dropdown value for populating 3rd one is lost and thus nothing happens.
Just use DEBUGGER and that should tell you how the execution is happening. Further, if you have missed using Page.IsPostback & ScriptManager.IsInAsyncPostBack page properties then do apply them such that the dropdowns are not getting freshly populated before the onchange event is fired.


有多种方法可以获取级联下拉列表.之前是服务器端,然后是传统的AJAX == XMLHttpRequest.现在,我们可以使用更新"面板或PageMethod.

Ajaxtoolkit提供了级联控件.可以选择不使用它,并具有以上任意一项.

当然选择应该起作用.使用XMLHttpRequest或UpdatePanel或PageMethod.
There are various ways to get Cascading dropdown. Earlier it was Server side, then traditional AJAX==XMLHttpRequest. Now, we can use Update panel or PageMethod for it.

Ajaxtoolkit provide a cascading control. One can opt not to use it and have any one of the above.

Surely the selections should work. Use XMLHttpRequest or UpdatePanel or PageMethod.



如果u使用级联下拉列表,则必须使用ajax工具套件.
Hi,
If u using cascading dropdown list, U must using ajax tool kit.


这篇关于级联下拉问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆