I have a form with target="_blank" that posts, process and return a PDF File in a new tab, the problem is:
When I do first time, it's all OK, but when i do again, instead of opening a new tab, it replaces the old one with the new content!
And if i'm using Internet Explorer, it posts my parameters null, in this case I need to close the new tab, and do it again
Controller:
public ActionResult SubmitReport(string parameter)
{
// all the code
return File(stream, "application/pdf");
}
View:
@using (Html.BeginForm("SubmitReport", "ResumoPagamentos", FormMethod.Post, new { area = "CI3S", @target = "_Blank" }))
{
// etc.. etc...
}
HTML target values are case-sensitive.
_Blank (capital B) is not the special _blank value (which always opens a new tab), but a tab named _Blank, which will be reused if it exists.
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