Wednesday, July 20, 2011

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:

No comments:

Post a Comment