Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Starting Page in new Browser window
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00878832
Message ID:
00879201
Views:
23
You can't open a new window from the server.
You have to move the logic to the browser or return the same page and add a script that open the new page onload.


Your best bet is to put an event handler directly in your user interface.
Add an onclick="return myfunction('the_parameters')" on the button and
add a script to the page that will check for an url as parameter:
function myFunction(uparam){
if (uparam.indexOf("http")>-1))
     {mywindow=window.open(uparam);
      return false;}
else
  {return true;}

}
The return value cancel the click in the case of an url and return true otherwise.
You have to pass the "CommandArgument" value to the function.

This untested script is only for demo purpose and you will have to rewrite it for your needs.

Wacth out! Scripting an open window can be tricky in these days of popup blockers!

I'm not even sure that this approach will work for you :-)
Let me know...


>>>I feel like an idiot because I'm sure the answer is staring me in the face.
>>>
>>>I use Response.Redirect() to fire a new page off in the current browser window.
>>>How do I fire the new page off in a new browser window?
>>>
>>>thank you in advanced.
>>
>>Put target="_blank" in your link tag or form tag.
>
>Giving all the information up front would save some time.
>
>This is not an option. I have a DataList driven menu system. My menu options reside in a SQL Serve table. I have a custom control on each page that queries that mennu table and builds the menu based on the page. When the user selects a menu option, a method is run with the page that needs to be displayed as a parameter.
>
>private void datlstMenuPage_ItemCommand(object source, System.Web.UI.WebConstrols.DataListCommandEventArgs e)
>{
> string lcCmd = e.CommandArgument.ToString().Trim().ToUpper() ;
> if (lcCmd.Substring(0,4)=="HTTP")
> {
> // calling different web site
> Response.Redirect(lcCmd,true)
> // Need code here instead of redirect to open new window for the site passed.
> }
> else
> {
> // calling page from this site
> Response.Redirect(lcCmd,true)
> }
>}
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform