ASP.NET
--
Questions
--
Followers
Top Experts
Within my webform I have 3 buttons. One of these buttons uses the postbackurl property to take the user to a print friendly version of the page.
Please could anyone suggest how I could modify the following button to open the target page in a new window without affecting the behaviour of the other 2 buttons on my original page?
<asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl="print.aspx" />
My intial thought was to use the <base target="_blank"></base> within the head tags but this is applied to the whole page.
Many thanks
Rit
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
---code behind---
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Button1.Attributes.Add("on
  End Sub
  <input type="button" value="Button" onclick="window.open('prin
Thanks for your time.
This works great to open the page in a new window but at the same time it also changes the original page to this destination too. Is there any way of keeping the original page available without affecting the postbackurl function?
Rit






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
It is doing a postback.
Rit
Rit

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
This seems to produce the right behaviour. I have left the postbackurl attribute in my control and it seems to not cause any issues.
Adding the javascript, would this stop the functioning of the postbackurl?... I can't actually test this at the moment as I am having issues within the whole postbackurl thing within a separate string...
https://www.experts-exchange.com/questions/22641815/PreviousPage-FindControl-'Object-reference-not-set-to-an-instance-of-an-object.html
Once I have resolved this I can confirm your solution.
Again. many thanks for your valuable contributions.
Rit
ASP.NET
--
Questions
--
Followers
Top Experts
The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications