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

Discussion in 'ASP .Net' started by Cheryl, Nov 11, 2003.

  1. Cheryl

    Cheryl Guest

    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
    Cheryl, Nov 11, 2003
    #1
    1. Advertising

  2. Cheryl

    alex bowers Guest

    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;dialogHeight:2
    00px;center;help:no;Yes;resizable:yes;status:no;scroll: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
    >
    >
    >.
    >
    alex bowers, Nov 11, 2003
    #2
    1. Advertising

  3. Cheryl

    Cheryl Guest

    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" <> wrote in message
    news:0a0001c3a83a$cd7f08d0$...
    > 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;dialogHeight:2
    > 00px;center;help:no;Yes;resizable:yes;status:no;scroll: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
    > >
    > >
    > >.
    > >
    Cheryl, Nov 12, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cheryl
    Replies:
    2
    Views:
    14,309
    alex bowers
    Nov 13, 2003
  2. Gordon
    Replies:
    3
    Views:
    280
    Steven Burn
    Apr 16, 2004
  3. PC HUA
    Replies:
    2
    Views:
    385
    PC HUA
    May 19, 2004
  4. sowen
    Replies:
    2
    Views:
    154
    Thomas 'PointedEars' Lahn
    Aug 8, 2007
  5. Replies:
    1
    Views:
    219
Loading...

Share This Page