Monday, October 20, 2008

JAVASCRIPT FOR REFRESH PARENT and UPDATE WINDOW FROM CHILED WINDOW

HI
HERE WE HAVE JAVASCRIPT FOR REFRESH PARENT and UPDATE WINDOW FROM CHILED WINDOW
AND CHANGE PARENT WINDOW CONTROL VALUE FROM CHILED WINDOW AFTWER SOME OPRATION .

a) refresh parent window:-
window . opener . location . reload();

function refreshParent() {
window . opener . location . reload();

window . opener . location . href = window . opener . location . href;

if (window . opener . progressWindow)

{
window . opener . progressWindow . close()
}
// window . close();
return false;
}

[asp:Button ID="btn2" runat="Server" Text="refreshParent" OnClientClick="refreshParent();" /]

b) PASS VALUE FROM CHILD WINDOW TO PARENT WINDOW

protected void btn_Click(object sender, EventArgs e)
{
//{window.opener.location.reload(); }
int intSum;

intSum = Convert . ToInt32(txt1 . Text) + Convert.ToInt32(TextBox1 . Text);

Page.ClientScript . RegisterStartupScript(this.GetType(), "close", "");
// lbl is control of parent window

}


c)

protected void btnSum_Click(object sender, EventArgs e) { //SumAndGO(varValue) int sum = Convert.ToInt32(TxtNum1 . Text) + Convert.ToInt32(TxtNum2 . Text); string Jscript = "SumAndGO(" + sum + ")"; Jscript = ""; ClientScript.RegisterStartupScript(this . GetType(), "Jscript", Jscript); }


Thanks
Help on desk

No comments: