仅在加载网格时显示进度

仅在加载网格时显示进度

本文介绍了仅在加载网格时显示进度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

In my application i have two drop downs the problem is on changing the drop down selection i am loads multiple grids in a tree structure, but loading these grids takes little longer time it nearly takes 5 min to load all the grids to avoid this i am showing the loading progress and below is the code that i have used







aspx code

<form>

<img style="visibility:hidden;" src="~/Image/loader.gif" runat="server" id="loading_image" />

<asp:DropDownList ID="ddl1" runat="server" Height="22px" Width="121px" OnSelectedIndexChanged="ddlYear_SelectedIndexChanged" AutoPostBack="True">

                                               </asp:DropDownList>
<asp:DropDownList ID="ddl2" runat="server" Height="22px" Width="121px" OnSelectedIndexChanged="ddlYear_SelectedIndexChanged" AutoPostBack="True">

                                               </asp:DropDownList>
</form>


.cs code

 protected void Page_Load(object sender, EventArgs e)
{

 ddlYear.Attributes.Add("onchange", "document.getElementById(\"loading_image\").style.visibility = \"visible\";");
}

protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)
    {
        i = 0;


        imgid.Visible = true;
        imgid1.Visible = true;
        imgid2.Visible = true;
        imgid3.Visible = true;
        imgid4.Visible = true;
        imgid5.Visible = true;
        imgid6.Visible = true;
        lbl1.Visible = true;
        lbl2.Visible = true;
        lbl3.Visible = true;
        lbl4.Visible = true;
        lbl5.Visible = true;
        lbl6 = true;
        if (ddl1.SelectedItem.Text != "Select")
        {
            lbl2.Text = ddlYear.SelectedItem.Text;
            DataBind(Session["abc"].ToString(), ddl1.SelectedItem.Text, Session["name"].ToString());
            Bind(Session["dept"].ToString(), ddl1.SelectedItem.Text, Session["name"].ToString());

        }
        else
        {

        }
    }
protected void ddl2_SelectedIndexChanged(object sender, EventArgs e)
    {
        i = 0;


        imgid.Visible = true;
        imgid1.Visible = true;
        imgid2.Visible = true;
        imgid3.Visible = true;
        imgid4.Visible = true;
        imgid5.Visible = true;
        imgid6.Visible = true;
        lbl1.Visible = true;
        lbl2.Visible = true;
        lbl3.Visible = true;
        lbl4.Visible = true;
        lbl5.Visible = true;
        lbl6 = true;
        if (ddl1.SelectedItem.Text != "Select")
        {
            lbl2.Text = ddlYear.SelectedItem.Text;
            DataBind(Session["abc"].ToString(), ddl1.SelectedItem.Text, Session["name"].ToString());
            Bind(Session["dept"].ToString(), ddl1.SelectedItem.Text, Session["name"].ToString());

        }
        else
        {

        }
    }







the problem with above code is the loading progress is always getting displayed even after the grids are loaded but i need to display the loading progress only for the time when grids are getting loaded and once if grids loaded this loading progress should not appear how can i do this 





我尝试过:



i尝试了上面的代码,但它没有工作



What I have tried:

i tried above code but its not working

推荐答案


这篇关于仅在加载网格时显示进度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 03:03