I want to open a new tab or a new page by using Response.Redirect
in a button click handler. I'm using a query string to pass some values. How can I open he page in a new tab?
protected void btnSave_Click(object sender, EventArgs e) { ...//some code to insert records Response.Redirect("NewQuote.aspx?val=" + this.txtQuotationNo.Text);//displaying gridview in other page to print what needed }
Use the method window. open(url, target) to open a new window (it depends on the browser or the user's settings whether the URL is opened in a new window or tab): window. open('http://stackoverflow.com', '_blank');
Response. Redirect sends an HTTP request to the browser, then the browser sends that request to the web server, then the web server delivers a response to the web browser. For example, suppose you are on the web page "UserRegister. aspx" page and it has a button that redirects you to the "UserDetail.
You just need to use the '_blank' without 'left=100,top=100,resizable=yes' if you want it to open in new tab.
Try this. This works sure for me...
protected void btnSave_Click(object sender, EventArgs e) { ...//some code to insert records Response.Write("<script>window.open ('NewQuote.aspx?val=" + txtQuotationNo.Text+"','_blank');</script>"); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With