Updating "Parent" Web Page with Value from Pop-up "Child" Web Page

Hi, all.


I'm having a problem updating a cell in a table row on my parent web page with the updated value from my child web page. I am using a script to pass the value back to the parent page (script is executed in child web page button exit event handler). If I put the updated value in a textbox on the parent page, it works fine. However, when I attempt to put the updated value in the table row cell I get an error: table row is not an object or the object is null. NOTE: I am doing this without a postback on the parent page. I tried creating all the rows dynamically in the code behind to insure I have objects for all my rolls and cells, but I still get the same error.

Here's the line of code it is failing on:

window.opener.document.forms(0).myTable.Rows.Item(1).Cells(2).value = '60';self.close()

Does anyone have any ideas?

Thanks,

Sue
0
sueolo
9/14/2005 12:31:42 PM
asp.net.client-side 24353 articles. 2 followers. Follow

8 Replies
1342 Views

Similar Articles

[PageSpeed] 14
Get it on Google Play
Get it on Apple App Store

Sue,

I might be wrong, but it looks like you're trying to use server-side syntax client-side. Try:

window.opener.document.forms[0].elements['myTable'].rows[1].cells[2].innerText = '60';

Also remember that all indexes into rows and cells is 0 based.

NC...
0
NC01
9/14/2005 1:18:16 PM
Hi NC.  Thanks very much for your quick response.  Unfortunately, after making the changes you suggested, I still get the same error.  I suspect it could be just a matter of getting the syntax correct.  


My client script is defined in my child web page and I have the following in my parent web page code behind to create the hyperlink in my table row column:

Dim exph As New HyperLink
exph.Text = "Teacher Subject Experience Detail"
exph.NavigateUrl = "#"
exph.Attributes.Add("onclick", "javascript:window.open('TchrSubjExpDetail.aspx?mypts=tblHOUSSE.Rows.Item(1).Cells(2)','SetPts','width=820,height=675,resizable=no,left=25,top=5')")

I have tried many variations for the hyperlink attribute after making your suggested script change, but I was not able to figure out what goes have mypts= if I change my client script as you suggested.

Thank you again for your kind reply and suggestion.

- Sue
0
sueolo
9/15/2005 12:59:14 PM

Sue, try this:

***Page1.aspx:

<!-- The table definition: -->
<table id="Table1">
 <tr>
  <td align="center" width="25%" colSpan="5">
   Row0Cell0
  </td>
  <td align="center" width="25%" colSpan="5">
   Row0Cell1
  </td>
  <td align="center" width="25%" colSpan="5">
   Row0Cell2
  </td>
  <td align="center" width="25%" colSpan="5">
   Row0Cell3
  </td>
 </tr>
 <tr>
  <td align="center" width="25%" colSpan="5">
   Row1Cell0
  </td>
  <td align="center" width="25%" colSpan="5">
   Row1Cell1
  </td>
  <td align="center" width="25%" colSpan="5">
   Row1Cell2
  </td>
  <td align="center" width="25%" colSpan="5">
   Row1Cell3
  </td>
 </tr>
</table>

***In the CodeBehind file of Page1.aspx in the Page_Load handler:

C#:
// Instantiate a HyperLink...
HyperLink hyperLink = new HyperLink();
// Add some properties...
hyperLink.ID = "Row0Cell0HyperLink";
hyperLink.NavigateUrl = "#";
hyperLink.Attributes.Add("onclick", "JavaScript:window.open('Page2.aspx');");
hyperLink.Text = "Click Me";
// Clear the Table cell...
Row0Cell0.InnerText = string.Empty;
// Add the HyperLink to the Table...
Row0Cell0.Controls.Add(hyperLink);

VB:
' Instantiate a HyperLink...
Dim hyperLink As New HyperLink()
' Add some properties...
hyperLink.ID = "Row0Cell0HyperLink"
hyperLink.NavigateUrl = "#"
hyperLink.Attributes.Add("onclick", "JavaScript:window.open('Page2.aspx');")
hyperLink.Text = "Click Me"
' Clear the Table cell...
Row0Cell0.InnerText = String.Empty
' Add the HyperLink to the Table...
Row0Cell0.Controls.Add(hyperLink)

***Page2.aspx:

<!-- The JavaScript in Page2.aspx to close the window: -->
<script language="javascript">
<!--
function closeWindow()
{
   window.opener.document.getElementById('Table1').rows[1].cells[2].innerText = '60';
   window.close();
}
// -->
</script>

***In the Page_Load handler of Page2.aspx, attach the closeWindow() method to a Button:
closeButton.Attributes.Add("onclick", "JavaScript:closeWindow(); return false;")
closeButton.Text = "Close Window"

Good luck!
NC...

0
NC01
9/16/2005 12:01:48 PM
Hi, NC.  Thank you for putting so much thought and effort into this problem.  Unfortunately, it still did not work.  I was able to update my parent web page table row cell by forcing a postback on the parent web page (not the best solution, but it worked).


Since I know this all works if I update a textbox on the parent web page (vs. the table row cell), I will continue to work on this as I have time.

Thank you again for all your helpful suggestions. I really appreciate the input.

- Sue
0
sueolo
9/16/2005 1:35:25 PM
Sue, If that doesn't work, you've got a problem in your code as I copyed it directly from a working page.

NC...
0
NC01
9/16/2005 3:26:22 PM
Hi, NC.  Thanks.  Yes, if it works for you, I definitely have some problem in my code.


What I don't follow from the example you provided is how the value on the child web page is returned to the parent web page (to update the value in the table row column - without a postback) without some kind of Request.QueryString notation in the table row column with the hyperlink on the parent asp.net page; i.e, TchrSubjExpDetail.aspx?mypts=myTable...' .

How does the parent page know what do do with the value being returned in the script from the child web page?

Thank you very much for your attention to this problem.

- Sue
0
sueolo
9/16/2005 3:40:21 PM
Because this:
  window.opener.document.getElementById('Table1').rows[1].cells[2].innerText = '60';

updates the table directly using the client-side (JavaScript/browser) DOM object.

NC...
0
NC01
9/16/2005 4:20:47 PM
Hi, NC.


Ah ha!

Thank you!

- Sue
0
sueolo
9/16/2005 5:18:02 PM
Reply:

Similar Artilces:

Mac OsX -no "page down" or "page up"
Name: Kurt Email: bruderkurt_at_yahoo.com Product: Bon Echo Summary: Mac OsX -no "page down" or "page up" Comments: Congratulations to you on Bon Echo Alpha 1! I'm using OSx for the Mac and the "page down" and "page up" buttons don't operate with Bon Echo (when wanting to scroll the page itself). They haven't operated with earlier Mac Firefox versions either, in my experience. I love Firefox, its speed and features. I'm loving the same and more with Bon Echo Alpha 1. The "page down" and "page up" wor...

About "ApplicationInstance" & "Profile" properties in my web page
Hi, The "ApplicationInstance" & "Profile" properties are never used in my code, but why they got created in every webpage classes? I know they are created by the ASP.NET infrastructure. Actually, both of them can be acquired by HttpContext of each page. Why a specific method is created for each of these two properties? codavid:The "ApplicationInstance" & "Profile" properties are never used in my code, but why they got created in every webpage classes? I know they are created by the ASP.NET infrastructure. Actually, both of ...

Web pages should be accessed with "https" only & not with "http"....?
Hi,I'm developing a online shopping cart where I want to create all my web pages to be opened with "https" only & not with "http". How can I prevent access to my site to be opened with "http"?   Thanks Set IIS to require SSL for the pages/site.  Check www.iis.net for help on IIS. JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue. There are a few cases to think about.  See this blog post for more info.Darrell Norton, MVPDarrell Norton's BlogPlease mark thi...

Paging Repeater treating page 11 as "1" and "1" not "11"
Dear AllI have a paging repeater, and I am displaying pages according to the amount of records I am retreiving from the database.  My code is as follows:-ASPX           <asp:Repeater runat="server" ID="rptPageNumbers" OnItemCommand="rptPageNumbers_ItemCommand">              <ItemTemplate>                <asp:LinkButton ID="LinkButton1" runat=&quo...

what's the different from "<page src="">" and "<page codeBehind="">"
what's the different from "<page src="">" and "<page codeBehind="">" Thank YOU how to make session' life longer? Thank You This very question was asked only 5 days ago. Searching the forums would have yielded the answer you require. However, see this thread. Steven BeyRecursion: see Recursion You can set a new value for the Session Timeout in your web.config file. Or, you can do it in a page through this property: Session.Timeout Note that if you choose the second method, the timeout will only be modified on this page,...

Need "Create Folder" in "Bookmark this Page"/"Page Bookmarked" dialog box
Name: Imagineer Product: Firefox Release Candidate Summary: Need "Create Folder" in "Bookmark this Page"/"Page Bookmarked" dialog box Comments: Using: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b4) Gecko/2008031317 Firefox/3.0b4 The ability to create new folders in the "Bookmark this Page" dialog box was in previous versions of Firefox. It needs to be in 3.0 as well. Browser Details: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b4) Gecko/2008031317 Firefox/3.0b4 From URL: http://hendrix.mozilla.org/ ...

superreview requested: [Bug 249231] Use only "web site" and "web page" in Firefox : [Attachment 155345] Same as previous with extraneous changes removed
R.J. Keller <rlk@mozdev.org> has asked Ben Goodger <bugs@bengoodger.com> for superreview: Bug 249231: Use only "web site" and "web page" in Firefox http://bugzilla.mozilla.org/show_bug.cgi?id=249231 Attachment 155345: Same as previous with extraneous changes removed http://bugzilla.mozilla.org/attachment.cgi?id=155345&action=edit ------- Additional Comments from R.J. Keller <rlk@mozdev.org> r=rlk@trfenv.com for the help content. Ben, can you review this for 1.0rc1? ...

superreview cancelled: [Bug 249231] Use only "web site" and "web page" in Firefox : [Attachment 155345] Same as previous with extraneous changes removed
Jeff Walden (remove +fxhelp to email) <jwalden+fxhelp@mit.edu> has cancelled R.J. Keller <rlk@mozdev.org>'s request for superreview: Bug 249231: Use only "web site" and "web page" in Firefox http://bugzilla.mozilla.org/show_bug.cgi?id=249231 Attachment 155345: Same as previous with extraneous changes removed http://bugzilla.mozilla.org/attachment.cgi?id=155345&action=edit ------- Additional Comments from Jeff Walden (remove +fxhelp to email) <jwalden+fxhelp@mit.edu> Removing review request from the patch that's now prompt-hindered w...

Your "http://www.google.com/firefox" web page should include a hyperlink to "Language Tools" underneath the "Advanced Search" hyperlink and the "Google" logo should be a hyperlink to the standard Goog
Name: Charles Douglass Garnett III Email: cgarnettatstudentdotumassdotedu Product: Firefox Summary: Your "http://www.google.com/firefox" web page should include a hyperlink to "Language Tools" underneath the "Advanced Search" hyperlink and the "Google" logo should be a hyperlink to the standard Google website. Comments: Your "http://www.google.com/firefox" web page should include a hyperlink to "Language Tools" underneath the "Advanced Search" hyperlink and the "Google" logo should be a hyperlink t...

"Page Inherits" , "Namespace" , "Register TagPrefix" , & "Assembly"
Hi,         I'm just start learning web matrix, can anyone explain to me about the "Page Inherits" , "Namespace" , "Register TagPrefix" , & "Assembly"  Thanks you~~          Most of the information you are asking you can get definitions from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconPage.asp linkHope it helps!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti Thanks a lot! :)...

Precedence of "where" ("of", "is", "will")?
Nobody on #perl6 today could answer this one. Is: Str | Int where { $_ } the same as: (Str | Int) where { $_ } or: Str | (Int where { $_ }) ? Followup questions, Mr. President: What kind of operators are "where", "of", "is", and "will"? Is there a reason that S03 doesn't list them? What are their precedence(s)? -- Chip Salzenberg - a.k.a. - <chip@pobox.com> Open Source is not an excuse to write fun code then leave the actual work to others. Chip Salzenberg writes: &...

.ALLCOL("%COLUMN%", " ", ", ", ", ")
Do you know anyway for me to exclude a subset of columns returned by this function. We have two columns (rec_user and rec_datetime) which are in all of our tables, but when generating triggers I want automatically generate a script which does not include those two columns but does include all other columns in that table. Bruce I should add that I am using PD 9.0.0.580. Bruce "Bruce Lamb" <lamb.bruce@mayo.edu> wrote in message news:6HgI315nCHA.155@forums.sybase.com... > Do you know anyway for me to exclude a subset of columns returned by this > function. ...

I need to foil using the backbutton to "back into" a "secure" web page
I'm constructing a site which will be "protected" under Forms Authentication. So far, everything works great. The issue I'm trying to overcome now is once a user hits the "Logout" button, which calls FormsAuthentication.Clear() then redirects to my login page, the user can use the back button to go back to the last page of the app they visited, or any others, for that matter. They can't do anything with them except view them or they get bumped to the Login page, but it bugs me that they can even navigate through previously viewed pages! How can I foil this? Thanks! E...

Removing "-- Web Page Dialog" and "- Microsoft Internet Explorer" from Title Bars
Hello People, Does anyone know how to remove "-- Web Page Dialog" from the title bar of pop-up windows? I know you can add loads of spaces in to push it off the right hand side, but I'd prefer something a little more elegant! On the same theme, can you remove the " - Microsoft Internet Explorer" from IE title bars? I have a feeling that the answer may be to much grief to consider, but I thought I'd ask, see if anyone else has done it. Cheers all, Tim...

Web resources about - Updating "Parent" Web Page with Value from Pop-up "Child" Web Page - asp.net.client-side

Resources last updated: 12/11/2015 11:30:21 PM