suresh pondicherry
asked on
MVC core open new window on button click
Hi All,
Am using MVC core. My controller has 3 action methods. One of the action method is opening pdf file in same page. I would like to open the pdf in new window. The below method opens new window but showing the error Bad Request - Invalid URL
<td align='right'>
<button id="PrintCmd" value="Print" class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-print"></span> Print
</button>
</td></tr>
$(document).ready(function () {
$("#PrintCmd").click(funct ion () {
alert('test');
var actionUrl = '<%= Url.Action("PDFForm", "PDFController" )%>';
window.open(actionUrl);
});
});
Kind regards,
Pooja
Am using MVC core. My controller has 3 action methods. One of the action method is opening pdf file in same page. I would like to open the pdf in new window. The below method opens new window but showing the error Bad Request - Invalid URL
<td align='right'>
<button id="PrintCmd" value="Print" class="btn btn-primary btn-sm">
<span class="glyphicon glyphicon-print"></span> Print
</button>
</td></tr>
$(document).ready(function
$("#PrintCmd").click(funct
alert('test');
var actionUrl = '<%= Url.Action("PDFForm", "PDFController" )%>';
window.open(actionUrl);
});
});
Kind regards,
Pooja
ASKER
I need to open fresh window...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
earlier i was using
var pData = document.getElementById('r eport').in nerHTML;
now i need to get the report value in the controller portion of the code...
var pData = document.getElementById('r
now i need to get the report value in the controller portion of the code...
Correct solution
Open in new window
and do away with the script