473,804 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ 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.A dd("onclick", "javascript:win dow.open(add.as px, '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 2481
acoder
16,027 Recognized Expert Moderator MVP
When opening the window, send a reference to the child window, e.g. "add.aspx?id=td 1". 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=td 1". 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
12076
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 time to update PHP to a newer version. So I simply replaces the old php-files with the new ones and of course kept the php.ini. But now, PHP doesn't work anymore. As soon as I request a page with php code, I get a "document contains no data"...
2
2449
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 window closes, the child closes too. Is there a way to keep the child window open? Yes keep it orphaned. -- John Dalberg
1
11591
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 http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
2
2912
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. Although the child form has a close button (with java script) if the user navigates the parent form to another form the child form is still open. Just wondering if there is a way to close the child form when the user navigates away with the parent...
10
4030
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 application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
2
7662
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 id="frmCoding" action="CodeView.aspx" method="post" runat="server"> ...
1
2327
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 value from the select box to a text box on the parent form. Here are my pages (in part)
0
1615
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 following to add an attribute to the body tag, body.Attributes.Add("onunload", "opener.location.href=opener.location.href;");. This causes the parent page to reload anytime the child page has a post back event or closes. Also I am getting an...
4
3989
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 the first child window closes after opening the second child. This is the second time I am typing the post, I lost all content because the site complaine I was using the lesser than symbol.
0
9571
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10561
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10318
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
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.