You can use the hyperlink to open a page in new window by specifying the target property as follows
<asp:HyperLink ID="HyperLink1" runat="server" Target="_blank" NavigateUrl="~/Quotations/Reports/EIQuotationReport.aspx?QuoteNo=SelectedQuoteNo">Open a new Page</asp:HyperLink>
pr_wainwrigh...
Member
35 Points
90 Posts
Open aspx page in new window or tab
Sep 21, 2009 12:08 PM|LINK
Hi,
I use the following code in a Buttons onClick handler.
Response.Redirect("~/Quotations/Reports/EIQuotationReport.aspx?QuoteNo="+SelectedQuoteNo);
Is it possible to open the EIQuotationReport.aspx web form in a new window or a new tab? I could change the button to a hyperlink if required.
Thanks
Paul.
matteo conta
Member
456 Points
92 Posts
Re: Open aspx page in new window or tab
Sep 21, 2009 12:14 PM|LINK
If you use a simple hyperlink you can use the target="_blank" property.
See also: http://www.htmlcodetutorial.com/linking/_A_TARGET_95y98y108y97y110y107y.html
Hope it helps,
yrb.yogi
Star
14460 Points
2402 Posts
Re: Open aspx page in new window or tab
Sep 21, 2009 12:15 PM|LINK
use button like as :
<asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" OnClientClick="aspnetForm.target='_blank';" />
where aspnetForm.target='_blank'; will use to open new tab/windows.
To more please visit this link http://yogeshyrbyogi.blogspot.com/2009/09/open-new-tabwindow-responseredirect.html
.Net All About
karthicks
All-Star
31382 Points
5424 Posts
Re: Open aspx page in new window or tab
Sep 21, 2009 12:19 PM|LINK
hi,
using link button you can do that
<a href="http://www.microsoft.com" target="_blank">
else if you want use button refer below article
http://weblogs.asp.net/infinitiesloop/archive/2007/09/25/response-redirect-into-a-new-window-with-extension-methods.aspx
Karthick S
CoolBond
Contributor
2828 Points
562 Posts
Re: Open aspx page in new window or tab
Sep 21, 2009 12:21 PM|LINK
Hi
You can use the hyperlink to open a page in new window by specifying the target property as follows
<asp:HyperLink ID="HyperLink1" runat="server" Target="_blank" NavigateUrl="~/Quotations/Reports/EIQuotationReport.aspx?QuoteNo=SelectedQuoteNo">Open a new Page</asp:HyperLink>
--to pass query string in hyper link, refer this
Or you can use window.open method of javascript to open the page in a new window, like
<script language="javascript" type="text/javascript">
function OpenWindow(SelectedQuoteNo) {
var queryString = "QuoteNo="+ SelectedQuoteNo;
window.open("~/Quotations/Reports/EIQuotationReport.aspx?" + queryString);
}
</script>
and call this function from a button click whose resposibility is only to open a new window
<asp:Button ID="btnOpen" runat="server" OnClientClick="openDialog(SelectedQuoteNo); return false;" />
Or if you need the above code from server side, ie after the execution of some code in the server side, write the below code, the place you required,
ScriptManager.RegisterStartupScript(this, this.GetType(), "openChild", "openDialog(SelectedQuoteNo);", true);
" If people criticize you, hurt you, or shout at you,Don't be bothered. Just remember, In every game, audience make the noise, not the players "
vinnypatel14
Participant
796 Points
125 Posts
Re: Open aspx page in new window or tab
Sep 21, 2009 12:33 PM|LINK
Hi,
use this code in to button click event, This example passes a value along with the url , whcih you can retrieve using the QueryString.
<CODE>
Dim sUrl As String = "~/Quotations/Reports/EIQuotationReport.aspx?QuoteNo=" & SelectedQuoteNo
Dim sScript As String = "<script language =javascript> "
sScript += "window.open('" & sUrl & "',null,'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=300,left=100,top=100');"
sScript += "</script> "
Response.Write(sScript)
</Code>
Live The Life mAh OwN wAy !!
Vinny..
qwsoftdraw
Member
36 Points
48 Posts
Re: Open aspx page in new window or tab
Aug 27, 2010 11:48 PM|LINK
This solutions works great for an application that I have. Thank you!