如何在asp.net中的每个回发中显示简单的加载图像? [英] How Can I Display A Simple Loading Image on every postback in asp.net?
问题描述
我只想在每次回发时显示正在加载进度条。
这些是我到目前为止所尝试的内容。
1.使用更新面板显示进度条。(这仅适用于更新面板)。
2.显示假jquery进度条(这不是特定于使用的时间)由我的网页中的任何控件引起的实际回发。)
但以下是我想要实现的内容。
受保护 void Button1_Click( object sender,EventArgs e)
{
startProgressBarOnBeginRequest( this .Page,sender)
// button1_click code execution ..
endProgressBarOnEndRequest( this .Page,sender)
}
public void startProgressBarOnBeginRequest(页面,对象发件人)
{
// 显示加载图片{Image1.Visible = true} =>这不会工作
/ / ???如何
}
public void endProgressBarOnEndRequest(Page page,< span class =code-keyword> object sender)
{
// 隐藏此处加载图片{Image1.Visible = false} =>这不会工作
// ???如何
}
我希望startProgressBarOnBeginRequest()和endProgressBarOnEndRequest()这两个方法在任何回发事件发生时执行控制..
我需要在global.asax中做些什么吗? {Application_Start和Application_End events}
提前致谢。
尝试显示在ASP.Net中的PostBack调用时加载图像 [ ^ ]。
I am just trying to display a "Loading" progress bar on every postback.
These are the things i have tried so far.
1. Using Update panel to display the progress bar.(This works only with update panel).
2. Displaying a Fake jquery progress bar(This is not specific with the time being consumed with the actual postback caused by any control in my webpage.)
But the below is what i am trying to implement.
protected void Button1_Click(object sender, EventArgs e)
{
startProgressBarOnBeginRequest(this.Page,sender)
//button1_click code execution..
endProgressBarOnEndRequest(this.Page,sender)
}
public void startProgressBarOnBeginRequest(Page page,object sender)
{
//show loading image here{Image1.Visible=true}=>this wont work
//??? how
}
public void endProgressBarOnEndRequest(Page page, object sender)
{
//hide loading image here{Image1.Visible=false}=>this wont work
//??? how
}
I want startProgressBarOnBeginRequest() and endProgressBarOnEndRequest() these 2 methods to execute whenever a postback event happens by any control..
is there anything that i need to do in global.asax? {Application_Start and Application_End events}
Thanks in advance.
Try the technique explained at Display loading image while PostBack calls in ASP.Net[^].
这篇关于如何在asp.net中的每个回发中显示简单的加载图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!