Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2004, 10:44 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Just a quick thought, shouldn't it be "RegisterClientScriptBlock" rather than "RegisterStartupScript"?

--

Joe
 
Old September 2nd, 2004, 10:51 AM
Authorized User
 
Join Date: Nov 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No - it needs to happen after the page has refreshed. If you use "RegisterClientScriptBlock" you get a blank page underneath the dialog box

Gary

 
Old March 22nd, 2005, 09:07 PM
Registered User
 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

having just read through this thread after searching the web high and low for a solution, it seems i'm having the same issue as you, only i'm using PHP not ASP.NET...

if you find a solution at all, please post it as soon as you can!

thanks ;)

- Japh
 
Old September 29th, 2005, 10:21 AM
Registered User
 
Join Date: Sep 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think solution is simple, when you use RegisterStartupScript add following to script tag: <script defer>. That way your page will be completely loaded before it executes script and self will have an object in it.;)

 
Old March 17th, 2006, 02:18 PM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Man!
The Problem you've gotten into is quite a huge one. I'm making a project and I've fallen into something like that. The issue here is that whenever you call an event(clicking a button for example), the Page_Load event is called, making the page to reload, then the code within the event you just called is executed; so, if you'd want to modify anything on the parent form, you'd have to refresh or reload the page. Another issue I've found has something to do with the "Modal Openers" methods(i.e. Response.Write, RegisterClientScriptBlock or RegisterStartupScript). These methods just make a reference to another page, a Modal Dialog in this case, but they don't work as constructors. For example, when I call a constructor, the code below that call "waits" till the object from the other class is created. The problem radicates here: if there's any piece of code below those "Modal Openers" it'll execute anyway, so if you wanted to do anything with the returned value, that's not possible.

In my case, in the Modal Form I ask the user to select some data, then I store that data into a DataBase and the Modal Form closes. Well, the thing is that I placed the code to acces that data just after the Response.Write method, the result: throws an exception because the data hasn't been stored. Quite frustrating. I hope someone kwons some way to solve this problem, it's now going on a world scale.....

Curiosity S-killed the Cat
 
Old April 19th, 2007, 01:28 PM
Registered User
 
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am having the same problem as Chent, but can not see how to resolve it from the notes above. PLEASE can someone help a real novice?!
My child and parent pages are aspx, I am having to showmodaldialog by setting up the Javascript for a response.write. But whenever I return to the parent page it says that the object I am trying to populate is null or not defined.
Parent code is:
PageFormat = "status:no; dialogWidth:350px; dialogHeight:600px; scroll: yes; help:no;" & _
             "resizable:yes; center:yes"

ToPage = "listPopUp.aspx?Job=" & tJobID & "&Type=" & tCheckType & _
         "&SeqNo=" & tSeqNo & "&Route=" & tRouteID & _
         "&street=" & tStreetID & "&district=" & tDistrict & "&sector=" & tSector & _
         "&walkcode=" & tWalkcode

strRedirect = "<script language=javascript>{var strReturn; "
strRedirect &= "strReturn=window.showModalDialog('" & ToPage & "',null,'" & PageFormat & "');"
strRedirect &= "if (strReturn != null) {document.frmBackchecking.lblAddressID.value=strRe turn;"
strRedirect &= "__doPostBack('','');}}"
strRedirect &= "</script>"

Have tried referencing the object for return as document.getElementFormID('lblAddressID').value, but with same error.
Seems to be doing everything except being able to see the form variable into which I want to drop the return value - WHY?!?!?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Forcing postback on parent page from modal dialog gp_mk ASP.NET 1.0 and 1.1 Professional 8 February 20th, 2007 12:44 PM
how to return value from modal dialog ajaypsingh Javascript 2 May 16th, 2006 05:14 AM
Modal Dialog window Problem anandham Javascript 7 February 16th, 2005 06:08 PM
Scrolling modal dialog to top gp_mk HTML Code Clinic 3 September 15th, 2004 07:04 AM
Modal dialog window eldanh ASP.NET 1.0 and 1.1 Basics 0 August 10th, 2004 02:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.