将部分视图添加到名为“FilePopUp”的视图文件夹中。这里使用 Telerik Window Control
代码 :-
<% Html.Telerik().Window()
.Name("PopupWindow")
//.Title("View PDF")
//.Icon(Url.Content("~/Content/Common/Icons/favicon.png"), "favicon")
.LoadContentFrom(Model.PDFFilePath).Modal(true)
.Buttons(buttons => buttons.Close(Url.Action("Controller", "Action")))
//.Buttons(buttons => buttons.Maximize(Url.Action("Controller")).Close(Url.Action("Controller", "Action")))
.Scrollable(false)
.Resizable()
.Draggable(true)
.Width(870)
.Height(500)
.Render();
%>
在您的控制器中:-
public ActionResult GetPdffile(string id)
{
try
{
FilePathAdmin filePath = new FilePathAdmin();
filePath.ERAPDFFilePath = this.WorkerService.GetPdfFilepath(id);
//string filepath = this.WorkerService.GetPdfFilepath(ID);
return PartialView("PopUpWindow", filePath);
}
catch (Exception ex)
{
bool reThrow = ExceptionPolicyWrapper.HandleException(ex, ExceptionPolicies.MVCPolicy);
if (reThrow)
throw;
}
return null;
}
在您的模型类中,创建另一个名为“FilePathAdmin”的类并在其中编写以下代码
public class FilePathAdmin
{
public string ERAPDFFilePath { get; set; }
}
就是这样..你完成了