Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Pop-up form sending data to the calling form?

Reply
Thread Tools

Pop-up form sending data to the calling form?

 
 
Bjorn Sagbakken
Guest
Posts: n/a
 
      06-30-2007
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


 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      06-30-2007
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/ar...6/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" <bjo-> 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
>



 
Reply With Quote
 
 
 
 
Masudur
Guest
Posts: n/a
 
      06-30-2007
On Jun 30, 5:19 pm, "Bjorn Sagbakken" <bjo-...@online.no> 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').val ue =
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

 
Reply With Quote
 
Bjorn Sagbakken
Guest
Posts: n/a
 
      06-30-2007
"Masudur" <> wrote in message
news: oups.com...
> On Jun 30, 5:19 pm, "Bjorn Sagbakken" <bjo-...@online.no> 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').val ue =
> 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


 
Reply With Quote
 
Bjorn Sagbakken
Guest
Posts: n/a
 
      06-30-2007
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/ar...6/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" <bjo-> 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
>>

>
>



 
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
Read data from enctype="multipart/form-data" form Kevin DeValck Ruby 1 05-17-2011 06:14 PM
sending email form data socal ASP .Net 1 04-07-2006 07:25 AM
Sending data from form to another Tamer Ibrahim ASP .Net 3 11-05-2005 02:02 PM
Problem Sending email form web form =?Utf-8?B?SnVzdGlu?= ASP .Net 3 02-21-2005 01:39 PM
sending data from one form to another automatically mark ASP .Net 1 03-02-2004 11:52 AM



Advertisments