Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional 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 December 27th, 2004, 01:52 PM
Registered User
 
Join Date: Oct 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default modal window


Hi all, I am developing an web application in vb.net 2003

Can I stop the execution of an aspx page??...I mean:

In the event onclick of a button I call a modal window doing the next:
Response.Write("<script>javascript:window.showModa lDialog('../form2.aspx?FormName=Form1" & "&CtrlName2="......</script>")

In the modal window I load "form2.aspx" who only insert a new record on a table and later I close It.

In the line just after the Response.write(.........) I try to read the value inserted in the modal form, but this is not possible...why??...because the debugger does not stop in the line where I call the modal window, making first the reader and later opening the modal window.

Now, this is how my program works:
step 1: call modal window
step 2: search the value in parent form.
step 3: insert record and close window

What I want is:
step 1: call modal window (stop execution)
step 2: insert record and close window
step 3: search the value in parent form.

I hope I explained my problem correctly....

Thanks in advance

 
Old December 27th, 2004, 02:50 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

I think you're misunderstanding how things work in the .NET world.

When you use Response.Write (which you shouldn't use anymore in 99.9% of the cases in an ASP.NET site), you're sending output to the client from a server side block of code.

This client side code is then interpreted by the client. To get at the result of something that happens in the client, you'll need to post the page back to the server (or use other means to communicate with the server).

So, the reason why this doesn't work is because you're effectively running two pages: the page that opens the dialog box, and the page that is presented in that dialog. Both pages are not related to each other.

A common way to fix this is like this:

1. Page1 loads and opens a new window (do you really need the new window? Can't you add the code that inserts the record in the main page??)

2. The new loads, the user fills in the details, hits the Save button, the page posts back to the server and the record is inserted. At the end of the insert (on post back), code is sent to the client that instructs the browsers to close the dialog, and then redirect the main page to display a message.

Personally, I would skip the dialog, and insert the record from the main page.

Does this help?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 28th, 2004, 04:03 AM
Registered User
 
Join Date: Oct 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi Imar,

yes, I really need the new window. Is not only a record what I insert on new window.

You say I have to try avoid the use of response.write(....), but, How do I open a new modal window?
How can I do both pages to be related to each other?

Whe you say "and then redirect the main page to display a message.", I cant do that, because when I close the modal window, the main page is completely loaded, and I need to launch an event or something to force a postback...and this is what i am trying to avoid.

Is possible to do what i am trying?

Thank you very much...and merry christmas!!







 
Old December 28th, 2004, 05:28 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You can use an ASP:Literal (http://msdn.microsoft.com/library/de...asp?frame=true) and set its Text property with the necessary JavaScript code.

Alternatively, use Page.RegisterClientScriptBlock (http://msdn.microsoft.com/library/de...BlockTopic.asp)

And why do you need a post back on the main page?? Can't you execute some client side code that reloads the main page??

E.g. window.opener.location.href='Bla';

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Paging Datagrid in a Modal Window fullingdale ASP.NET 1.0 and 1.1 Professional 0 April 24th, 2008 11:26 AM
Autopostback in a modal window gabrieldcr2 ASP.NET 1.x and 2.0 Application Design 3 February 7th, 2006 01:59 PM
Modal Window... babloo81 Javascript 2 February 21st, 2005 07:08 AM
Modal Dialog window Problem anandham Javascript 7 February 16th, 2005 06:08 PM
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.