如何在ASP上使用Jquery:Dropdown? [英] how to work on Jquery on ASP:Dropdown?

查看:65
本文介绍了如何在ASP上使用Jquery:Dropdown?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,



以下是我的下拉菜单。在选定的索引更改后,我还有一个下拉列表被绑定。



Hello Experts,

Below is my Drop down. On selected index changed I have one more drop down that gets bound.

<asp:DropDownList ID="ddlManufacturer" AutoPostBack="true" Width="100%"

                 runat="server" DataTextField="I001001" DataValueField="I001001"

                 OnSelectedIndexChanged="ddlManufacturer_SelectedIndex" Height="16px" >
             </asp:DropDownList>





在此期间,我想调用一个JavaScript pleasewait()Till Second drop down绑定。



我试过做谷歌我做了我的尝试好吧,它工作很奇怪。它显示了pleasewait(),但直到第二次下拉才绑定。它显示并消失,然后第二次下降填充。但是我希望显示直到第二个下拉列表绑定

有人可以帮我吗?



During this time, I want to call a JavaScript pleasewait() Till Second drop down binds.

I tried doing Google and I did my try as well and It worked weird. It shows pleasewait() but not till the second drop down binds. It shows and vanishes and then second drop down fills. But I want to show till the second dropdown is bind
Can anyone help me with this please?

推荐答案

<script type="text/javascript">
    // note order is important, this has to go at the top
    function showMessage() {


( #pleaseWait)显示();
}

函数hideMessage(){
("#pleaseWait").show(); } function hideMessage() {


(#pleaseWait)。hide();
}
< / script >

< 表格 id = form1 runat = server >

< div id = pleaseWait > 请稍候... < / div >

< asp:ScriptManager runat = server / >

< asp:UpdatePanel runat = server >
< ContentTemplate < span class =code-keyword>>
< asp:DropDownList ID = ddlParent runat = server AutoPostBack = true < span class =code-attribute> onchange = showMessage()

OnSelectedIndexChanged = ddlParent_SelectedIndexChanged >
< asp:ListItem runat = 服务器 > ; 父A < / asp:ListItem >
< asp:ListItem runat = 服务器 > 父B < / asp:ListItem >
< asp:ListItem runat = server > 父C < / asp:ListItem >
< / asp:DropDownList >

< asp:DropDownList ID = ddlChild runat = server >
< asp:ListItem runat = 服务器 > 请先选择父级< / asp:ListItem >
< < span class =code-leadattribute> / asp:DropDownList >
< / ContentTemplate >
< ; / asp:UpdatePanel >

< / form >
("#pleaseWait").hide(); } </script> <form id="form1" runat="server"> <div id="pleaseWait">Please wait...</div> <asp:ScriptManager runat="server" /> <asp:UpdatePanel runat="server"> <ContentTemplate> <asp:DropDownList ID="ddlParent" runat="server" AutoPostBack="true" onchange="showMessage()" OnSelectedIndexChanged="ddlParent_SelectedIndexChanged"> <asp:ListItem runat="server">Parent A</asp:ListItem> <asp:ListItem runat="server">Parent B</asp:ListItem> <asp:ListItem runat="server">Parent C</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="ddlChild" runat="server"> <asp:ListItem runat="server">Please select parent first</asp:ListItem> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel> </form>





代码落后





code behind

protected void Page_Load(object sender, EventArgs e)
{
    ScriptManager.RegisterStartupScript(this, this.GetType(), "hideMessage", "hideMessage();", true);
}

protected void ddlParent_SelectedIndexChanged(object sender, EventArgs e)
{
    ddlChild.Items.Clear();

    ddlChild.Items.Add(ddlParent.SelectedValue + " 1");
    ddlChild.Items.Add(ddlParent.SelectedValue + " 2");
    ddlChild.Items.Add(ddlParent.SelectedValue + " 3");

    // simulate a delay
    System.Threading.Thread.Sleep(3000);
}


这篇关于如何在ASP上使用Jquery:Dropdown?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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