Us there a way of open a page in a new window without using javascript? Thanks
use a hyperlink and set the target property to "_blank"
Thanks, but I want to open a different page depending on certain conditions with the same hyperlink. Example;
If a = 1 then HyperLink.NavigateURL="page.aspx?ID=ex1"else HyperLink.NavigateURL="page.aspx?ID=ex2"end if
But I always have to click 2 times to get the link to work. Is there any other way? Thanks again.
Do you have a popup-blocker?
no. it has nothing to do with the pop up blocker...
Hi,
The server side code cannot control whether a page is opened in the current window or a new window. So if you want to combine the URL in code behind with the client script, you have to use the RegisterStartupScript() method.
Here is a sample code.
ClientScriptManager csm = Page.ClientScript;
string strURL = "www.microsoft.com";
csm.RegisterStartupScript(this.GetType(), "PopupScript", "window.open('" + strURL + "');",true);
But you have to disable the popup blocker, to make it work properly.
And with that I can change the strURL in runtime? I want to use a button that uses more that one strURL depending on certain conditions... Thanks
check you check below, if this works for you.
ClientScriptManager csm = Page.ClientScript;
if(condition1) then
string strURL = "www.microsoft.com";
if(condition2) then
string strURL = "www.asp.net";
csm.RegisterStartupScript(this.GetType(), "PopupScript","window.open('" + strURL + "');",true);
Yes. That script works.
But do u guys hav any way 2 let new open windows do not display as a pop up windows.
Cos by default most of browser block the pop up.
Thanks in advance. He Tian Min.
0 comments:
Post a Comment