Pop-up form sending data to the calling form?

Discussion in 'ASP .Net' started by Bjorn Sagbakken, Jun 30, 2007.

  1. With ASP.NET 2.0

    I want to add a nice and sleek feature to my application where the user
    typical clicks a button to open a smaller window to enable a search, lets
    say for customers or products or whatever.

    So far this is easy by adding a script tag and window.open with appropriate
    settings.

    The challenge comes when the user has searched and selected his item, and
    clicks [Ok] in this popup form.
    How do I return the values to the calling form, into the appropriate
    textboxes?

    If this cannot be done directly on the client side, I think this may be done
    with a postback of the caller form, but then; how do I force a callback of
    the first form (the caller form) when the secondary (the pop-up) closes?

    (And yes, I know the search issue can be solved with hiding/showing panels
    or views on an asp-form, but I would like to simulate a more windows like
    behaviour, if possible)

    Bjorn
     
    Bjorn Sagbakken, Jun 30, 2007
    #1
    1. Advertising

  2. Bjorn Sagbakken

    Teemu Keiski Guest

    Hello,

    maybe my blog post helps you

    ASP.NET: How to create a postback on a main page from a popup window
    http://aspadvice.com/blogs/joteke/archive/2005/06/15/2340.aspx

    Basically you can just set them with script, but you can also do it via
    postback. Per my sample, it's totally up to how the script on the main page
    is generated.


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net



    "Bjorn Sagbakken" <> wrote in message
    news:...
    > With ASP.NET 2.0
    >
    > I want to add a nice and sleek feature to my application where the user
    > typical clicks a button to open a smaller window to enable a search, lets
    > say for customers or products or whatever.
    >
    > So far this is easy by adding a script tag and window.open with
    > appropriate settings.
    >
    > The challenge comes when the user has searched and selected his item, and
    > clicks [Ok] in this popup form.
    > How do I return the values to the calling form, into the appropriate
    > textboxes?
    >
    > If this cannot be done directly on the client side, I think this may be
    > done with a postback of the caller form, but then; how do I force a
    > callback of the first form (the caller form) when the secondary (the
    > pop-up) closes?
    >
    > (And yes, I know the search issue can be solved with hiding/showing panels
    > or views on an asp-form, but I would like to simulate a more windows like
    > behaviour, if possible)
    >
    > Bjorn
    >
     
    Teemu Keiski, Jun 30, 2007
    #2
    1. Advertising

  3. Bjorn Sagbakken

    Masudur Guest

    On Jun 30, 5:19 pm, "Bjorn Sagbakken" <> wrote:
    > With ASP.NET 2.0
    >
    > I want to add a nice and sleek feature to my application where the user
    > typical clicks a button to open a smaller window to enable a search, lets
    > say for customers or products or whatever.
    >
    > So far this is easy by adding a script tag and window.open with appropriate
    > settings.
    >
    > The challenge comes when the user has searched and selected his item, and
    > clicks [Ok] in this popup form.
    > How do I return the values to the calling form, into the appropriate
    > textboxes?
    >
    > If this cannot be done directly on the client side, I think this may be done
    > with a postback of the caller form, but then; how do I force a callback of
    > the first form (the caller form) when the secondary (the pop-up) closes?
    >
    > (And yes, I know the search issue can be solved with hiding/showing panels
    > or views on an asp-form, but I would like to simulate a more windows like
    > behaviour, if possible)
    >
    > Bjorn


    Hi Bjorn

    well you can access your parent pages elements using javascript...
    here is a little code that will help you understand...

    if(window.opener!=null)
    {
    window.opener.document.getElementById('Text1').value =
    document.getElementById('Text2').value;
    }

    this is a script used in child page to set a value to a text box in
    the parent page...
    the trick is window.opener object of a page...

    but i would like to suggest different technique...
    why don't you user a javascript dhtml layer div popup and then use
    javascript to hide and show the search box..
    and also take advantage of Ajax to get the search result...

    http://ajax.asp.net/ajaxtoolkit/ have few beautiful modal popup
    demonstration

    Thanks
    Munna
    www.kaz.com.bd
    http://munnacs.110mb.com
     
    Masudur, Jun 30, 2007
    #3
  4. "Masudur" <> wrote in message
    news:...
    > On Jun 30, 5:19 pm, "Bjorn Sagbakken" <> wrote:
    >> With ASP.NET 2.0
    >>
    >> I want to add a nice and sleek feature to my application where the user
    >> typical clicks a button to open a smaller window to enable a search, lets
    >> say for customers or products or whatever.
    >>
    >> So far this is easy by adding a script tag and window.open with
    >> appropriate
    >> settings.
    >>
    >> The challenge comes when the user has searched and selected his item, and
    >> clicks [Ok] in this popup form.
    >> How do I return the values to the calling form, into the appropriate
    >> textboxes?
    >>
    >> If this cannot be done directly on the client side, I think this may be
    >> done
    >> with a postback of the caller form, but then; how do I force a callback
    >> of
    >> the first form (the caller form) when the secondary (the pop-up) closes?
    >>
    >> (And yes, I know the search issue can be solved with hiding/showing
    >> panels
    >> or views on an asp-form, but I would like to simulate a more windows like
    >> behaviour, if possible)
    >>
    >> Bjorn

    >
    > Hi Bjorn
    >
    > well you can access your parent pages elements using javascript...
    > here is a little code that will help you understand...
    >
    > if(window.opener!=null)
    > {
    > window.opener.document.getElementById('Text1').value =
    > document.getElementById('Text2').value;
    > }
    >
    > this is a script used in child page to set a value to a text box in
    > the parent page...
    > the trick is window.opener object of a page...
    >
    > but i would like to suggest different technique...
    > why don't you user a javascript dhtml layer div popup and then use
    > javascript to hide and show the search box..
    > and also take advantage of Ajax to get the search result...
    >
    > http://ajax.asp.net/ajaxtoolkit/ have few beautiful modal popup
    > demonstration


    Thanks a lot. I tried your first suggestion, and it worked like a dream.
    But I will also pursue the Ajax solution, it is just a bit more to get into.
    But it seems like a good idea for the future.
    Just one small silly question at the end: How do I close the pop-up window
    with code? Would this be server code or client code?

    (there has never been any need to close any form before, only rediirect...)

    Bjorn
     
    Bjorn Sagbakken, Jun 30, 2007
    #4
  5. Thanks. I have saved your blog to my favorites and will try it out later.
    It explains a lot, so I think it will be very useful.

    Bjorn

    "Teemu Keiski" <> wrote in message
    news:...
    > Hello,
    >
    > maybe my blog post helps you
    >
    > ASP.NET: How to create a postback on a main page from a popup window
    > http://aspadvice.com/blogs/joteke/archive/2005/06/15/2340.aspx
    >
    > Basically you can just set them with script, but you can also do it via
    > postback. Per my sample, it's totally up to how the script on the main
    > page is generated.
    >
    >
    > --
    > Teemu Keiski
    > AspInsider, ASP.NET MVP
    > http://blogs.aspadvice.com/joteke
    > http://teemukeiski.net
    >
    >
    >
    > "Bjorn Sagbakken" <> wrote in message
    > news:...
    >> With ASP.NET 2.0
    >>
    >> I want to add a nice and sleek feature to my application where the user
    >> typical clicks a button to open a smaller window to enable a search, lets
    >> say for customers or products or whatever.
    >>
    >> So far this is easy by adding a script tag and window.open with
    >> appropriate settings.
    >>
    >> The challenge comes when the user has searched and selected his item, and
    >> clicks [Ok] in this popup form.
    >> How do I return the values to the calling form, into the appropriate
    >> textboxes?
    >>
    >> If this cannot be done directly on the client side, I think this may be
    >> done with a postback of the caller form, but then; how do I force a
    >> callback of the first form (the caller form) when the secondary (the
    >> pop-up) closes?
    >>
    >> (And yes, I know the search issue can be solved with hiding/showing
    >> panels or views on an asp-form, but I would like to simulate a more
    >> windows like behaviour, if possible)
    >>
    >> Bjorn
    >>

    >
    >
     
    Bjorn Sagbakken, Jun 30, 2007
    #5
    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. Replies:
    2
    Views:
    8,604
    Randy Webb
    Feb 4, 2006
  2. Bone Ur
    Replies:
    4
    Views:
    422
    Bone Ur
    Dec 19, 2007
  3. Chris Davoli

    Tool Tip pop up - pop up time is too short

    Chris Davoli, Feb 24, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    502
    Lee Atkinson
    Feb 24, 2009
  4. samppi
    Replies:
    27
    Views:
    549
    David A. Black
    Dec 5, 2007
  5. Madame Blablavatsky
    Replies:
    8
    Views:
    207
    Dr John Stockton
    Sep 16, 2005
Loading...

Share This Page