我想返回我的ActionResult在新頁面上顯示?我想返回一個新的頁面上顯示的ActionResult?
下面的這個調用是我唯一沒有能夠在新頁面上顯示的調用嗎?
任何人都可以告訴我要添加什麼來獲得這個權利,我已經使用Window.open與按鈕,但現在我有一個RedirectToAction。
這就是我想要顯示的新頁/窗口上的呼叫:
return RedirectToAction("Print", new { id = contractInstance.SalesContractId });
我有按鈕已與此代碼這樣:
window.open('Contract/Print/' + $(this).attr('id'));
打印的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 });
}
}
什麼不起作用...? – gdoron
每一件事情都在工作,但我希望我在新的頁面或選項卡上打印,我如何才能在新頁面上顯示RedirectToAction? – Pomster
類似於:return RedirectToAction(window.open(「Edit」,new {id = id,error = err.Message})); – Pomster