unable to open website

G

Guest

I have a C# asp.net webform with a Link Button to a website but it's not
opening the website correctly. It's saying "The page cannot be found". But
the website is loading when I use IE. Below is the code and thanks in advance.

private void lbtnWebsite_Click(object sender, System.EventArgs e)
{
string script = "<script language=\"javascript\">";
script += "var target = '_blank';";
script += "window.open('ActiveVendors.aspx', 'target',
'fullscreen=no,channelmode=no,
toolbar=no,menubar=no,location=no,directories=no,height=400,width=350,resizable=no,scrollbars=yes')";
script += "window.open('website', 'target', 'fullscreen=no,channelmode=no,
toolbar=no,menubar=no,location=no,directories=no,height=800,width=800,resizable=yes,scrollbars=yes')";
script += "</script>";
Page.RegisterStartupScript("winOpen", script);
}

where website = "http://www.marconi.com"
 
I

Ignacio Machin \( .NET/ C# MVP \)

hi,

I have no idea why you use this code, would't it be easier if you just use
a regular link in the client?
What is the point in doing a postback in this case?

in case you have to hide/show the button you can solve this in several ways,
either using CSS or just including the A tag inside a grouping web control


cheers,
 
G

Guest

I'm sorry but I posted the wrong code. This is the actual code:

private void lbtnWebsite_Click(object sender, System.EventArgs e)
{ string website = Session["website"].ToString();
string script = "<script language=\"javascript\">";
script += "var target = '_blank';";
script += "window.open('website', 'target',
'fullscreen=no,channelmode=no,
toolbar=no,menubar=no,location=no,directories=no,height=800,width=800,resizable=yes,scrollbars=yes')";
script += "</script>";
Page.RegisterStartupScript("winOpen", script);
}

where Session["website"] is assigned somewhere else.
 
G

Guest

It's already working. Thanks.

Ignacio Machin ( .NET/ C# MVP ) said:
hi,

I have no idea why you use this code, would't it be easier if you just use
a regular link in the client?
What is the point in doing a postback in this case?

in case you have to hide/show the button you can solve this in several ways,
either using CSS or just including the A tag inside a grouping web control


cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top