PDA

Click to See Complete Forum and Search --> : how to pop up a new window


cooldudeattitud
Mar 29th, 2004, 02:03 PM
Hi I was just wondering how to pop up a new window in asp.net. I have searched from the database....and if it doesn't return any results than I want a new window to popup...How do we do this concept....thanks for ur help in advance...

wey97
Mar 29th, 2004, 02:35 PM
It depends on what page event you want the window to pop up on...

Let's say you have a button named Button1 and you want a new window to pop up when the button is clicked then your code would look like this:

// C# code

private void Page_Load(object sender, System.EventArgs e)
{


// Put user code to initialize the page here
string winURL = "http://www.vbforums.com/";
string features = "height=600,width=800,resizable=yes";

Button1.Attributes.Add("onclick", "javascript:window.open('"
+ winURL + "', null, '" + features + "');");

}