Opening a new window

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

How do I open a new window (webpage) without closing the current webpage in
C# ASP.NET? The new window (webpage) will be smaller and centered on the
screen and it will contain a DataGrid.

Thanks,
newbie
 
Newbie,

AFAIK, you cannot.

By the way, this "Popup" way is very much reglemented by the new XP SP2.

I hope this helps,

Cor
 
Hi Newbie,

You could do this:

<code>
private void Button_Click(System.Object sender, System.EventArgs e)
{
string script = "<script language=\"javascript\">";
script += "var winOptions =
'scrollbars=yes,resizable=no,fullscreen=no,channelmode=no,status=no,toolbar=no,menubar=no,location=no,directories=no,height=200';";
script += "var target = '_blank';";
script +=
window.open('mydatagridpage.aspx?query=blah',target,winOptions);";
script += "</script>";
Page.RegisterStartupScript("winOpen", script);
Response.Redirect("thispage.aspx");
}
</code>

There are other ways to do it also, but this is probably the most
straight-forward for an example.

HTH,
~d
 
Don't about ASP.Net but for normal html You can set the target propertyof
the control to _blank. So that it will open in a new window.
 
Back
Top