Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

Pop-up form sending data to the calling form?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bjorn Sagbakken - 30 Jun 2007 12:19 GMT
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 - 30 Jun 2007 13:01 GMT
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.

Signature

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

> With ASP.NET 2.0
>
[quoted text clipped - 20 lines]
>
> Bjorn
Bjorn Sagbakken - 30 Jun 2007 16:47 GMT
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

> Hello,
>
[quoted text clipped - 31 lines]
>>
>> Bjorn
Masudur - 30 Jun 2007 13:03 GMT
> With ASP.NET 2.0
>
[quoted text clipped - 19 lines]
>
> 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
Bjorn Sagbakken - 30 Jun 2007 16:34 GMT
>> With ASP.NET 2.0
>>
[quoted text clipped - 46 lines]
> 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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.