Monday, October 08, 2007

Providing Google like "Processing........" status

If you wanted to provide status bar for your pages as in Google.
you cab use below code to achieve the same.
1.Currently you are on Page1(start.aspx).Your post back leads you to Page2(End.aspx)
2.End.aspx is taking a while to load, so you want to show some status as in shown in Gmail.

Below screen shot will explain the same in detail.

In Code behind file of Start.aspx button click event handler looks like this.

public void BtnClick(object sender, System.EventArgs e)
// Write your code here
string url = "Inter.aspx?target=End.aspx";

Inter.aspx just consist simple mesage as below.

Inter.aspx.cs looks like below.
public class Inter : System.Web.UI.Page
protected HtmlGenericControl bd;
private void Page_Load(object sender, System.EventArgs e)
// Put user code to initialize the page here
HtmlGenericControl body = (HtmlGenericControl)Page.FindControl("bd");
if (body != null)
body.Attributes["onload"] = GetAutoRedirectScript();


public string GetAutoRedirectScript()
return String.Format("location.href='{0}';", "End.aspx");