Tuesday, October 13, 2009
Open New Window in ASP.NET web page using JavaScript
Collected Article from:
http://dotnetspidor.blogspot.com/2009/01/open-new-window-in-aspnet-web-page_28.html
I have found much tricks in different tutorials and forums on opening new window in asp.net web page, using JavaScript, jquery etc. Here I have put most useful of ways to open new window (and pop-up window) in asp.net web page. I hope these tricks will be helpful.
1. Open New Window from HyperLink control
asp:hyperlink id="hyperlink1" runat="server" navigateurl="~/Default.aspx" target="_blank">/asp:HyperLink
Clicking this hyperlink will open the Default.aspx page in new window. In most of the cases this simple coding can save need of lots of JavaScript code!
2. Open New Window on Button Click
asp:button id="btnClck" runat="server" onclick="btnClick_Click"
protected void Page_Load(object sender, EventArgs e){
if (!IsPostBack)
{
string url = "MyNewPage.aspx?ID=1&cat=test";
string fullURL = "window.open('" + url + "', '_blank', 'height=500,width=800,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,titlebar=no' );";
btnClck.Attributes.Add("OnClick", fullURL);
}
}
article from MSDN
http://msdn.microsoft.com/en-us/library/ms536651(VS.85).aspx#Mtps_DropDownFilterText
GL Page and Pax page previews using javascript pop ups
http://dotnetspidor.blogspot.com/2009/01/open-new-window-in-aspnet-web-page_28.html
I have found much tricks in different tutorials and forums on opening new window in asp.net web page, using JavaScript, jquery etc. Here I have put most useful of ways to open new window (and pop-up window) in asp.net web page. I hope these tricks will be helpful.
1. Open New Window from HyperLink control
asp:hyperlink id="hyperlink1" runat="server" navigateurl="~/Default.aspx" target="_blank">/asp:HyperLink
Clicking this hyperlink will open the Default.aspx page in new window. In most of the cases this simple coding can save need of lots of JavaScript code!
2. Open New Window on Button Click
asp:button id="btnClck" runat="server" onclick="btnClick_Click"
protected void Page_Load(object sender, EventArgs e){
if (!IsPostBack)
{
string url = "MyNewPage.aspx?ID=1&cat=test";
string fullURL = "window.open('" + url + "', '_blank', 'height=500,width=800,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,titlebar=no' );";
btnClck.Attributes.Add("OnClick", fullURL);
}
}
article from MSDN
http://msdn.microsoft.com/en-us/library/ms536651(VS.85).aspx#Mtps_DropDownFilterText
Subscribe to Comments [Atom]