Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: open window a new window and retrieve data from it. C#

Reply
Thread Tools

Re: open window a new window and retrieve data from it. C#

 
 
Cheryl
Guest
Posts: n/a
 
      11-13-2003
Hi alex,

I am new in both javascript and asp.net. After putting in the code, I
have encountered this error msg, "Object doesn't support this property or
method"
on "window.dialogArguments.ProcessModalData
(dropdown1.value,dropdown2.value,dropdown3.value); " . And does not know what
when wrong.

And I got another problem, after the form data have passed back to the main
page. How am I going to get the data and place it on the datagrid.


Thanks
Cheryl
"alex bowers" <(E-Mail Removed)> wrote in message
news:0a0001c3a83a$cd7f08d0$(E-Mail Removed)...
> Hi Cheryl,
> you can achieve this by opening a model window through
> some javascript in the main page, then calling a function
> in the original page from the new window when the ok
> button is clicked that processes the data from the modal
> window.
> The original page can process the modal form data using
> javascript with the example below, but you can extend
> this to process the data server side by forcing a
> postback.
>
> alex
>
> Here's a code example:
>
> [Modal Window - ModalWindow.aspx] [C#]
> function ModalButtonClick()
> {
> if( window.dialogArguments )
> window.dialogArguments.ProcessModalData
> (dropdown1.value,dropdown2.value,dropdown3.value);
> window.close();
> }
>
> <SELECT id='dropdown1'>
> //additional dropdownlists rendered here
> <INPUT type=button onclick='ModalButtonClick();'
> value='submit'>
>
> [main page] [C#]
> function ShowModalWindow()
> {
> window.showModalDialog
> ('ModalWindow.aspx',this,'dialogWidth:400px;dialog Height:2
> 00px;center;help:no;Yes;resizable:yes;status:no;sc roll:no'
> );
>
> }
>
> function ProcessModalData(string1,string2,string3)
> {
> //javascript to do something with the form data
> passed in here
> }
>
> >-----Original Message-----
> >Hi,
> >
> > I have encounter a problem.Language use is C#. I would

> like to open a new
> >window (is a modal window, where I m not able to switch

> from parent window
> >after this window is open)from the parent window , where

> there are 3
> >dropdownlists and a "OK" button. Upon clicking the

> button, this window
> >will close and the select of the dropdownlists will be

> collect and send back
> >to the parent window. But I am do not know how to do

> it. Can somebody help.
> >
> >Thanks
> >Cheryl
> >
> >
> >.
> >




 
Reply With Quote
 
 
 
 
alex bowers
Guest
Posts: n/a
 
      11-13-2003
hi cheryl,
The dialog form is opened by the parent window from
javascript (eg window.showModalDialog
('ModalWindow.aspx',this,'[etc,etc]')). Note the use
of 'this' as the second argument in the function; this
allows you to refer back to the parent window from the
dialog form's javascript.
Now when you want to refer back to the parent window
(which is when you pass arguments back to the parent from
the dialog form - eg the form data) you need to write
some CLIENT-SCRIPT such as
window.dialogArguments.ProcessModalData
([form data args])
this will call a function in the parent window called
ProcessModalData.
From the error message you received, it sounds as though
you may have been calling this function using server-side
code. You can only do this on the client (or write
server-side code that writes script out to the client -
but you'll need to research this a little if you haven't
done it before).
The next step is to process the data on the main page
somehow, and there a few different techniques I've used
to do this. The simplest is to store the data in a
hidden-text field on the client, then process it using
server side code later. You can also force the page to
post-back to itself from the client-side script, then
process the data on the server. Look into calling the
__doPostBack('control','') client-function for info on
this.

alex

>-----Original Message-----
>Hi alex,
>
> I am new in both javascript and asp.net. After

putting in the code, I
>have encountered this error msg, "Object doesn't support

this property or
>method"
>on "window.dialogArguments.ProcessModalData
>(dropdown1.value,dropdown2.value,dropdown3.value) ;" .

And does not know what
>when wrong.
>
>And I got another problem, after the form data have

passed back to the main
>page. How am I going to get the data and place it on the

datagrid.
>
>
>Thanks
>Cheryl
>"alex bowers" <(E-Mail Removed)> wrote in

message
>news:0a0001c3a83a$cd7f08d0$(E-Mail Removed)...
>> Hi Cheryl,
>> you can achieve this by opening a model window through
>> some javascript in the main page, then calling a

function
>> in the original page from the new window when the ok
>> button is clicked that processes the data from the

modal
>> window.
>> The original page can process the modal form data using
>> javascript with the example below, but you can extend
>> this to process the data server side by forcing a
>> postback.
>>
>> alex
>>
>> Here's a code example:
>>
>> [Modal Window - ModalWindow.aspx] [C#]
>> function ModalButtonClick()
>> {
>> if( window.dialogArguments )
>> window.dialogArguments.ProcessModalData
>> (dropdown1.value,dropdown2.value,dropdown3.value);
>> window.close();
>> }
>>
>> <SELECT id='dropdown1'>
>> //additional dropdownlists rendered here
>> <INPUT type=button onclick='ModalButtonClick();'
>> value='submit'>
>>
>> [main page] [C#]
>> function ShowModalWindow()
>> {
>> window.showModalDialog
>>

('ModalWindow.aspx',this,'dialogWidth:400px;dialog Height:2
>>

00px;center;help:no;Yes;resizable:yes;status:no;sc roll:no'
>> );
>>
>> }
>>
>> function ProcessModalData(string1,string2,string3)
>> {
>> //javascript to do something with the form data
>> passed in here
>> }
>>
>> >-----Original Message-----
>> >Hi,
>> >
>> > I have encounter a problem.Language use is C#. I

would
>> like to open a new
>> >window (is a modal window, where I m not able to

switch
>> from parent window
>> >after this window is open)from the parent window ,

where
>> there are 3
>> >dropdownlists and a "OK" button. Upon clicking the

>> button, this window
>> >will close and the select of the dropdownlists will be

>> collect and send back
>> >to the parent window. But I am do not know how to do

>> it. Can somebody help.
>> >
>> >Thanks
>> >Cheryl
>> >
>> >
>> >.
>> >

>
>
>
>.
>

 
Reply With Quote
 
 
 
 
alex bowers
Guest
Posts: n/a
 
      11-13-2003
There's another simpler way of doing this - a child form
can change the url of it's parent window using the
following script function:
opener.location='something.aspx?argument1=x&argume nt2=y'
This will force the parent page to refresh itself on the
server, and process the querystring arguments accordingly
(which are the values determined in the child window).
This will work with a child window that is opened using
window.open(), however I'm not sure if this will work
with a modal dialog.
alex

>-----Original Message-----
>Hi alex,
>
> I am new in both javascript and asp.net. After

putting in the code, I
>have encountered this error msg, "Object doesn't support

this property or
>method"
>on "window.dialogArguments.ProcessModalData
>(dropdown1.value,dropdown2.value,dropdown3.value) ;" .

And does not know what
>when wrong.
>
>And I got another problem, after the form data have

passed back to the main
>page. How am I going to get the data and place it on the

datagrid.
>
>
>Thanks
>Cheryl
>"alex bowers" <(E-Mail Removed)> wrote in

message
>news:0a0001c3a83a$cd7f08d0$(E-Mail Removed)...
>> Hi Cheryl,
>> you can achieve this by opening a model window through
>> some javascript in the main page, then calling a

function
>> in the original page from the new window when the ok
>> button is clicked that processes the data from the

modal
>> window.
>> The original page can process the modal form data using
>> javascript with the example below, but you can extend
>> this to process the data server side by forcing a
>> postback.
>>
>> alex
>>
>> Here's a code example:
>>
>> [Modal Window - ModalWindow.aspx] [C#]
>> function ModalButtonClick()
>> {
>> if( window.dialogArguments )
>> window.dialogArguments.ProcessModalData
>> (dropdown1.value,dropdown2.value,dropdown3.value);
>> window.close();
>> }
>>
>> <SELECT id='dropdown1'>
>> //additional dropdownlists rendered here
>> <INPUT type=button onclick='ModalButtonClick();'
>> value='submit'>
>>
>> [main page] [C#]
>> function ShowModalWindow()
>> {
>> window.showModalDialog
>>

('ModalWindow.aspx',this,'dialogWidth:400px;dialog Height:2
>>

00px;center;help:no;Yes;resizable:yes;status:no;sc roll:no'
>> );
>>
>> }
>>
>> function ProcessModalData(string1,string2,string3)
>> {
>> //javascript to do something with the form data
>> passed in here
>> }
>>
>> >-----Original Message-----
>> >Hi,
>> >
>> > I have encounter a problem.Language use is C#. I

would
>> like to open a new
>> >window (is a modal window, where I m not able to

switch
>> from parent window
>> >after this window is open)from the parent window ,

where
>> there are 3
>> >dropdownlists and a "OK" button. Upon clicking the

>> button, this window
>> >will close and the select of the dropdownlists will be

>> collect and send back
>> >to the parent window. But I am do not know how to do

>> it. Can somebody help.
>> >
>> >Thanks
>> >Cheryl
>> >
>> >
>> >.
>> >

>
>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Window.Open get new tab instead of new window in FireFox Fredzidd@gmail.com Javascript 1 02-29-2008 03:06 AM
Can I retrieve the object of the window opened by window.open sowen Javascript 2 08-08-2007 05:26 PM
window.open() doesn't open new Window in Opera PC HUA Javascript 2 05-19-2004 02:29 AM
Need to open a new browser window, not a new window Gordon ASP General 3 04-16-2004 10:46 PM
open window a new window and retrieve data from it. C# Cheryl ASP .Net 2 11-12-2003 05:30 AM



Advertisments