473,238 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,238 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.     }
  6.  
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.         {
  3.  
  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);
  13.  
  14.  
  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);
  20.  
  21.  
  22.             sbScript.Append("window.close();");
  23.             sbScript.Append(Environment.NewLine);
  24.  
  25.             sbScript.Append("</script>");
  26.             ClientScript.RegisterStartupScript(this.GetType(), "CloseWindow", sbScript.ToString());
  27.         }
  28.  

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> 
  5.  
Thanks In advance

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

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

Similar topics

1
by: POnfri | last post by:
Hi I'm having trouble setting the main form visible from within the child form. I have set the main form to hide (SignatureMain.Hide()) I then load the child form from within a button on form1...
5
by: Lyn | last post by:
Hi, I hope someone can help. I have a main form which mostly fills the Access window. In the bottom half of this form I have a tab control to display various types of data related to the main...
3
by: Omar Llanos | last post by:
I have Form1 and Form2 (which is inherited from Form1), and I created a button in Form2 that will fill up a textbox in Form1. What code would do that? I tried the simplest way: //from child...
5
by: BrianDH | last post by:
Hi I had never had to do this and it took me a while to work it out. Just thought I would post it to maybe help someone else with the same issue:...
1
by: Michael | last post by:
Hi Everyone, I seem to be having a problem accessing a menuitem on the MDIParent from a child form. From a login (frmSecurity -child form) screen, I need to hide a menuitem based on the users...
0
by: Ben | last post by:
Please excuse if this ends up being a double post at some point. I tried posting using another website which crashed, so I am not sure if it will ever get posted. As such I decided to try again...
3
by: jimcolli | last post by:
I have a parent form with a menu button that has a handler. I want to call this same handler when a button on a child form is clicked. I have this simplified code in the main form's Load...
9
by: cybervegan | last post by:
Hi, First, the background info: I have a parent form, New_Jobcard that contains a combo-box to select Cust_ID. The combobox shows customers sorted by name and address, like this: Cust_ID V ...
2
by: =?Utf-8?B?U2FpbXZw?= | last post by:
Hi and Hello. Im new at .net framework. Now Im using C# . I have a little problem. How can I get a value of a text in the mdi parent form to child form. Example in VB6: form1.text1.text =...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.