Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Navigation -> Open New Window Dilemma... asp.net

Posted on 2005-05-08
8
Medium Priority
?
339 Views
Last Modified: 2008-01-09
In my asp.net app, I am trying to open a new window from a button.click event.  This new window (window#2) should be opened from my "search" webform (window#1), where the new window contains the search results.


Everytime the user updates the search criteria in window#1 and click search button I want to update window#2 with the results. (preferable without opening a window#3, rather refresh window#2 if window#2 (results page) was already open.)  The way I send my search criteria to window#2 is via a session variable (sql WHERE clause)


I have tried a couple different approaches, however, none of them seems to work 100%, I need few pointers.


Here's what I tried:

1. Simplest solution seems to change a setting on my search webform to point to results page: <base target="resultspage.aspx(window#2)">
The above worked fine, however I have more than one button on my search page which performs postbacks, hence everytime a postback is performed (from a button other than search button) it would push the html from the server to window#2, I only want it to push html to window#2 when I click on the search button.  Thus is there a way that I can dynamically change the target of my form server side?


2. I added OnClick js script serverside, where I would build-up my javascript function (or I just add button1.attributes.add("OnClick",.... ), when user clicks the search button first time it works fine, after that it opens a new window everytime and does not update my session variable (new WHERE clause).  Reason being that once the button1.attibute is added it doesn't seem to go to the server side code (where I set my new session variable) it just opens the new windown right away without using the updated session variable, hence I would see the same search results when I change my search criteria.

Any help would be appreciated.
Thanks!

0
Comment
Question by:newbreedcc
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:puranik_p
ID: 13957275
What you can do is instead of using <base target="resultspage.aspx(window#2)">, use jacascript with window.child.

For each of the buttons which goes for search, check..
if (window.child == null)
{
// open a new window
}
else
{
//use the same window.
//example..window.child.location.href = "searchresult.aspx"
}
0
 
LVL 1

Author Comment

by:newbreedcc
ID: 13995251
I went with a different approach in the end.

Please close and refund.
0
 
LVL 14

Expert Comment

by:puranik_p
ID: 14008243
newbreedcc, can you post the approach that you used.
It might be helpful to others.
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 14

Expert Comment

by:puranik_p
ID: 14217874
I recommend:
if newbreedcc returns back with solution, PAQ/Refund
else accept Pura
0
 
LVL 1

Author Comment

by:newbreedcc
ID: 14220676
I open a new window with script, and everytime the same link is clicked it would not open another new window, rather detect that window is already open and refresh.  I created a menu bar that acts as a launch pad to open menu items, here's how.

btnItemMstr.Attributes.Add("OnClick", "newWindowItemMstr = window.open('itemMstr_AdvSearch.aspx','newWindowItemMstr', 'width=' + (screen.availWidth - 165) + ',height=' + (screen.availHeight - 50) + ',left=150,top=0,status=yes,toolbar=no,menubar=no,scrollbars=yes,resizable=yes'); newWindowItemMstr.focus();")

0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 14254550
Closed, 125 points refunded.
Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question