仅在加载网格时显示进度 [英] Display progress only when grids are getting loaded

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

问题描述

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

推荐答案

你可以利用UpdatePanel和UpdateProgress控件来阻止您的UI和显示加载消息。如果您需要像当前状态相同的进度条,您需要增强。



以下为供参考,您需要根据需要更新它



在ASP.NET中显示动态状态的进度(C#)| Ian Reddy's [ ^ ]
You can make use of UpdatePanel and UpdateProgress controls to block your UI and show loading message. If you need something like progress bar with current status same you need to enhance.

Below is for reference you need to update it per your need

Display Progress with Dynamic Status in ASP.NET (C#) | Ian Reddy's[^]


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

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