How to do multiple popup window using ASP.NET 3.5 and AJAX Control and Javascript?

There are three ways to popup a new window. The first way to do popup window,

this.lnkNewWindow.Attributes.Add("onclick", "window.open('NewWindow.aspx', 'NewWindow', 'toolbar=no, menubar=no, directories=no, resizable=yes, scrollbar=yes');return false;");

this the second way to do popup window,

<asp:LinkButton ID="lnkNewWindow" runat="server" Text="New Window" onclick="javascript:openNewWindow();” />

Put this javascript inside script tag,

function OpenNewWindow()
{
window.open('NewWindow.aspx', 'NewWindow', 'toolbar=no, menubar=no, directories=no, resizable=yes, scrollbar=yes');
return false;
}

This is the third way to do popup window,

this.lnkNewWindow.Attributes.Add("onclick", "javascript:OpenNewWindow();");

To close this window just call window.close() like this,

this.btnClose.Attributes.Add("onclick", "window.close()");

If you are doing popup window that has functionality of exporting to pdf or excel with multiview control and updatepanel. You need to put postback trigger. Here is my link.

Here are my References for popup window:

Advertisements
This entry was posted in ASP.NET 3.5 And JavaScript, C# 3.5, C# 3.5 AND ASP.NET 3.5, JavaScript. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s