471,593 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,593 software developers and data experts.

Calling Parent form Event from child page

I have a parent form and on button click I am calling a child page where i have a textbox and a button. On button click of child form I am passing the value of the Textbox to the Textbox in parent page and now I want to fire an event.

Button click event on parent page- parameter is txtBlank (TextBox in parent page)

Expand|Select|Wrap|Line Numbers
  1. function SetRange(Src)
  2.     {
  3.     window.open("SetRange.aspx?src=" + Src, "_blank", "status = 1, ontop=true, height=110, width=210, left=680, top=280, alwaysRaised = 1 resizable = 0,scrollbars=1", true);           
  4.     //window.opener.document.getElementById("txtBlank).TextChanged();
  5.     }
The child page code is ----- Button click event on child page- where txtTopRange is Textbox in child page and Request.QueryString["src"] = txtBlank (TextBox in parent page)

Expand|Select|Wrap|Line Numbers
  1. protected void Button1_Click(object sender, EventArgs e)
  2.         {
  4.             System.Text.StringBuilder sbScript = new System.Text.StringBuilder();
  5.             sbScript.Append("<script language='javascript'>");
  6.             sbScript.Append(Environment.NewLine);
  7.             sbScript.Append("window.opener.document.forms[0].");
  8.             sbScript.Append(Request.QueryString["src"]);
  9.             sbScript.Append(".value = '");
  10.             sbScript.Append(txtTopRange.Text);
  11.             sbScript.Append("';");
  12.             sbScript.Append(Environment.NewLine);
  15.                 //sbScript.Append("window.opener.document.forms[0].");
  16.                 //sbScript.Append(Request.QueryString["src"]);
  17.                 //sbScript.Append(".fireEvent('TextChanged')");
  18.                 //sbScript.Append(";");
  19.                 //sbScript.Append(Environment.NewLine);
  22.             sbScript.Append("window.close();");
  23.             sbScript.Append(Environment.NewLine);
  25.             sbScript.Append("</script>");
  26.             ClientScript.RegisterStartupScript(this.GetType(), "CloseWindow", sbScript.ToString());
  27.         }

The commented is where i am trying to call the event TextBox_TextChanged of parent form. The code above the commented one is passing the correct the value to my parent form's textBox.

On debugging the Javascript code is as-

Expand|Select|Wrap|Line Numbers
  1. <script language='javascript'>         working fine
  2. window.opener.document.forms[0].txtBlank.value = '5';      working fine
  3. window.opener.document.forms[0].txtBlank.fireEvent('TextChanged');      not working
  4. </script> 
Thanks In advance

Jul 10 '08 #1
1 3831
16,027 Expert Mod 8TB
fireEvent is IE-only. Why not just call the function which gets fired onchange?
Jul 10 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Omar Llanos | last post: by
2 posts views Thread by =?Utf-8?B?U2FpbXZw?= | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.