Basically I want a button that opens a page in a new window containing my http://fake.com/Report/PageFixes... page. Currently I have a button in a form but if there is a better way to do it then I'm up for that too.
<% using (Html.BeginForm("PageFixes", "Report", new { id = 9 }, FormMethod.Get, new { onSubmit="window.open()" })) %>
<% { %>
<%= Html.CSButton(new ButtonViewData() { Text = "Submit" })%>
<% } %>
You don't need to have a form. Just add the following HTML to your view:
<button type="button" onclick="window.open('<%= Url.Action("PageFixes", "Report", new { id = "9" } ) %>', '_blank'); return false;">submit</button>
I wasn't sure how you were getting the 9 for the ID but I assume it is from your model so you could replace the "9" with Model.ID or something.
The key is generating the url with Url.Action and then just using the basic javascript function window.open to open the url in a new browser window.
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