I've seen many people saying to use an iframe or a new page to display a ReportViewer control. Is there a way to display the control inline with the rest of my page without using an iframe?
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- parameters in routing do not work MVC 3
- There is no ViewData item with the key 'taskTy
- TextBoxFor decimal
- Install ASP.NET 5.0 version of System.ServiceModel
相关文章
- MVC CDN fallback for Style Bundle
- Add to htmlAttributes for custom ActionLink helper
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
You can use
.ascx
user controls as partial views with Razor if they inherit fromSystem.Web.Mvc.ViewUserControl
.In this instance, you can create an
ASCX
that contains yourReportViewer
control and the requisiteScriptManager
in yourView\Controller
folder:In the code-behind, make sure to include the following in the
Page_Init
; otherwise, you won't be able to use any options in the report view:You also want to make sure that your control inherits from
System.Web.Mvc.ViewUserControl
:To use this control, you would do something like this in your Razor page:
You can then setup your ReportViewer in the
Page_Load
of the control as you normally would. You will have access to anobject
namedModel
, which you can cast to the type of the model that you send in and then use: