I have an application that displays various data in an ASP.NET GridView. The values are displayed as a selection of combobox. When I select comobo box, the reload process is taking about 8 seconds. I would like to display a gif of load before starting the process and end it cancel the display image. I tried to use a thread for this, but it did not work very well. Could someone help me?
我有一个应用程序,在ASP.NET GridView中显示各种数据。值显示为组合框的选择。当我选择comobo box时,重新加载过程大约需要8秒钟。我想在开始进程之前显示一个加载的gif,然后结束它取消显示图像。我尝试使用一个线程,但它没有很好地工作。有人能帮帮我吗?
protected void Page_Load(object sender, EventArgs e)
{
//My Image
imageLoad.Visible = true;
Assembly myAsm = Assembly.Load("PainelBordo");
AssemblyName aName = myAsm.GetName();
Version version = aName.Version;
BusinessLogicLayer bll = new BusinessLogicLayer();
LoadDDLWRTG(CreateDataTableWRTGList());
LoadDataPBList();
TimerRefresh.Interval = Convert.ToInt32(ConfigurationManager.AppSettings["TimerInterval"].ToString());
lblUpdateDate.Text = "Refresh " + bll.DateUpdateFormat(DateTime.Now);
// My image
imageLoad.Visible = false;
}
Combobox SelectedIndexChanged.
Combobox SelectedIndexChanged。
protected void ddlWRTGroup_SelectedIndexChanged(object sender, EventArgs e)
{
Page_Load(sender, e);
}
1 个解决方案
#1
1
Drag and drop a Button(btnInvoke) and Label(lblText) control inside the UpdatePanel. Also add a <div id="divImage">
inside the UpdatePanel. This div will contain a .gif image that depicts progress and is initially set to invisible style="display:none"
. On the button click, perform a time consuming task. In our case, we have set a delay of 3 seconds by using Thread.Sleep(3000)
在UpdatePanel中拖放Button(btnInvoke)和Label(lblText)控件。还要在UpdatePanel中添加
C#
C#
protected void btnInvoke_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
lblText.Text = "Processing completed";
}
Took from here
从这里开始
#1
1
Drag and drop a Button(btnInvoke) and Label(lblText) control inside the UpdatePanel. Also add a <div id="divImage">
inside the UpdatePanel. This div will contain a .gif image that depicts progress and is initially set to invisible style="display:none"
. On the button click, perform a time consuming task. In our case, we have set a delay of 3 seconds by using Thread.Sleep(3000)
在UpdatePanel中拖放Button(btnInvoke)和Label(lblText)控件。还要在UpdatePanel中添加
C#
C#
protected void btnInvoke_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
lblText.Text = "Processing completed";
}
Took from here
从这里开始