473,473 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Updating the parent page after the child page closes...

45 New Member
Hi there,

I have a problem. I am devloping a C# ASP.NET User Control (a .ascx file). I want to display a table on the user control. This table is generated on the fly. First the user control displays a Panel (<asp:Panel />) asking the user to enter the noumer of rows and columns. It also provides the user with a link button (asp:LinkButton />). When the user clicks the link button the panel disappears and a new panel is displayed with the specified number of rows and columns. This of course is handled in the "IsPostBack" part of the Page_Load. That means, I check for the condition whether the page is posted back and then create the table with the Table t = new Table();, TableRow tr = new TableRow(); and TableCell tc = new Table Cell();. Ihave two for loops (one inside the other) for costructing the table. That is, I create as many cells (columns) for every row that that the user specified.

Now, I have assigned a javascript to all of the cells like this....

tc.Attributes.Add("onclick", "javascript:window.open(add.aspx, 'Add' , 'width=500, height=500, resizable=yes'");

Now, my problem is, when this child window closes I want to use the text entered in the Text box (in the child window) to be added to the respective cell that was clicked and that too without a postback. Because if I postback the table will be created all over again causing all data to be lost.

In short,

1] I want to somehow use/pass the vatiable/value to the parent page from the child page.
2] I want to update the table cell without a postback.

I thank you all,

Regards.
Feb 28 '07 #1
3 2447
acoder
16,027 Recognized Expert Moderator MVP
When opening the window, send a reference to the child window, e.g. "add.aspx?id=td1". Then you can use this id to ref. the table cell that the iuse clicked on. One way to get this id is to use:
Expand|Select|Wrap|Line Numbers
  1. "add.aspx" + this.id
Then in the child window, use
Expand|Select|Wrap|Line Numbers
  1. window.opener.document.getElementById(id)
to refer to the table cell. Use the innerHTML property to change the table cell and you're done!
Feb 28 '07 #2
querry
45 New Member
When opening the window, send a reference to the child window, e.g. "add.aspx?id=td1". Then you can use this id to ref. the table cell that the iuse clicked on. One way to get this id is to use:
Expand|Select|Wrap|Line Numbers
  1. "add.aspx" + this.id
Then in the child window, use
Expand|Select|Wrap|Line Numbers
  1. window.opener.document.getElementById(id)
to refer to the table cell. Use the innerHTML property to change the table cell and you're done!
Does not appear to work.

Ok. I need a way to preserve the controls i create even if I postback. I mean, I visit the page - enter the no of row and the no of columns. Click a link button which causes to post back. I test, in the Page_Load to see whether it is a postback, if it is I generate dynamic controls that represent the table. [Table, TableCell(s), TableRow(s)]. Now after that I need to again post back but I don't want to loose the dynamically created controls. Is there a way to preserve the dynamically created controls and their values over postbacks??

Please help.

Regards.
Mar 1 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Does not appear to work.
Post your code.
Mar 1 '07 #4

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

Similar topics

2
by: Tobias | last post by:
Hi! I had Apache 2.0.47 and PHP 4.3.0 DEV running successfully on a W2k Server. For some reason, I couldn't get PHP to read XML-Attributes with the DOM XML -functions. So I thought, it would be...
2
by: John Dalberg | last post by:
I have a closed box system which opens an html page. The page closes by the system. I have access to the html page. I added code to open a child window from this page. However when the parent...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
by: Paul | last post by:
Hi this is related to a previous post, hopefully just a bit clearer description o the problem. I have a parent form that opens a new form (child form) while still leaving the parent form open....
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
2
by: Jason Wilson | last post by:
I am trying to create a popup window that will give a user the option to lookup a value and return it to a textbox on the parent page. Here is my relevant code: Code on Parent <form...
1
by: Richard | last post by:
Greetings. I am total newbie to Javascript so what is written below is probably a bunch of cobblers!! Any assistance in correcting my code much appreciated. I wish the popped up child to pass...
0
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi just wondering if anyone knows if there is a way to tell if a child window is still open in the code behind in the parent window (web application vs.net 2005)? I have a web app and am using the...
4
by: Buddha | last post by:
Hello, I posted this on two forums, without too much help .. and I am kinda stuck in this. I need to refresh the parent page from the second child window which is opened by the first child and...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.