Monday 26 September 2011

How to Refresh Parent Page

Question : The Question arise that . i have a data control and i click on this template then an window open offcourse this is the child window and we show some data on this child window . i want refresh the parent page after load the child window .How to do this
Answer:
lets take an example what you want simply when user see her/his mail then after clicking the mail the row color is chage . Exactly we want this in your project .. So there are a solution ..
write the following code on your child window page laod  or where you want

const string cRefreshParent = "<script language='javascript'>" +

    "  window.opener.document.forms(0).submit();" + "</script>";
    const string cRefreshParentKey = "RefreshParentKey";
    if (!this.Page.ClientScript.IsClientScriptBlockRegistered(cRefreshParentKey))
    {
        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
        cRefreshParentKey, cRefreshParent);
    }

I think   this solution is quite easy but very useful if you want to create Web applications in which  open child window and you want to refersh parent page.

No comments:

Post a Comment