ActionResult を新しいページに表示したいのですが?
以下のこの呼び出しは、新しいページに表示できなかった唯一の呼び出しですか?
これを正しく行うために何を追加すればよいか、誰でも教えてもらえますか? ボタンで Window.open を使用しましたが、今は RedirectToAction があります。
これは、新しいページ/ウィンドウに表示したい呼び出しです:
return RedirectToAction("Print", new { id = contractInstance.SalesContractId });
私はすでにこのコードでこれを行っているボタンを持っています:
window.open('Contract/Print/' + $(this).attr('id'));
Print actionResult は次のようになります。
public ActionResult Print(int id) // sales contract Id
{
ParameterFields paramFields = CreateParameterFields(id); // pass the id of the contract
// Save the report run details
Guid reportRunId;
SaveReportRunDetails(paramFields, out reportRunId);
try
{
<<< Print code >>>
//Open a new page on this return would also be a good answer :)!!!!!!!
return File(arrStream, "application/pdf");
}
catch (Exception err)
{
ViewBag.ErrorMessage = err.Message;
return RedirectToAction("Edit", new { id = id, error = err.Message });
}
}