Sunday, October 25, 2009

Open a New Window On Server Side using Javascript Code in Asp.net

·

// open new window with specified path

function OpenWindow(url)

{
newwindow = window.open(url, 'mywindow', 'width=500,height=400');

}

Now In .aspx.cs page or server side to use the javascript window open you have to use the following code

StringBuilder popupScript = new StringBuilder();
popupScript.Append("");
// if you are using script manager - update panel then this
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "PopupScript", popupScript.ToString(), false);
//else
Page.RegisterStartupScript("PopupScript", popupScript.ToString());

1 comments:

~ AB ~ said...
April 29, 2010 at 2:11 PM  

Hi pankaj, how r u dear..

I saw in cygnet. How is job goin on?

Regards,
ALTaf