Views: 153.3K
Replies: 5
Archived
|
ASP.NET Response.Redirect to open a new browser window?We are using ASP.NET Webforms (not MVC).
My question is this: Is it possible to open a new browser window using a postback and then some variety of Response.Redirect? Thanks. Hans Overkamp, Apr 03, 2011
|
|
Reply 1This question was posed almost 2 years ago.
Is there anything new in JavaScript or HTML 5 that makes this possible? Thank you. Trey Henlon, Feb 24, 2013
|
|
Reply 2hi
u try this one!!!! <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /> ----------------------------------------------------------------------------------------------------------------------------- protected void btnSubmit_Click(object sender, EventArgs e) { Response.Write("<script>window.open( '../yourpage.aspx' , '-blank' );</script>"); } Dhina S, Apr 30, 2012
|
|
Reply 3As mentioned above you can't use Response.Redirect but with JavaScript its possible (as long as js its enabled).
Hope this helps you //PostBack approch protected void Button1_Click(object sender, EventArgs e) { //Consume ParamX ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('YourPage.aspx?Param=" + ParamX.ToString() + "');",true); } //Page Load approach protected void Page_Load(object sender, EventArgs e) { Button1.OnClientClick="javascript:window.open('YourPage.aspx?Param=" + ParamX.ToString() + "');"; } Ricky Owen, Apr 19, 2011
|
|
Reply 4Yeah, without JS this is not possible but with some clever hack you can achieve the desired result.
For detailed information refer this post. http://weblogs.asp.net/infinitiesloop/archive/2007/09/25/response-redirect-into-a-new-window-with-extension-methods.aspx Hope this helps. Rajesh Pillai, Apr 04, 2011
|
|
Reply 5As far as I know, this is not possible to do using Response.Redirect since it is on the server side. Your best bet would probably be to use JavaScript... but that will not work if the user has JavaScriptdisabled.
Good Luck! Robert Blixt, Apr 04, 2011
|