我试图在MVC中实现SSRS查看器。在经历了很多痛苦和痛苦之后,我已经通过自定义控件实现了这一点。
报告呈现得很好,但我试图将模型传递给控件,如下所示:
@Html.Partial("VendorReport", Model)
要调用此ascx控件:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="VendorReport.ascx.cs" Inherits="ExtendedServicesReportingPortal.Views.Reports.VendorReport" %>
<uc1:RazorReportViewer ID="VendorReportViewer" runat="server" ...Omitted Custom Properties... />
但是如果我尝试访问模型,我会收到此错误:
The ViewUserControl '~/Views/Reports/RazorReportViewer.ascx' cannot find an IViewDataContainer object. The ViewUserControl must be inside a ViewPage, a ViewMasterPage
这是相关的控制器控制器方法:
public ActionResult TransactionCountsAndInvoiceAmounts(TransactionCountsAndInvoiceAmountsModel model)
{
if(model == null) model = new TransactionCountsAndInvoiceAmountsModel();
return View(model);
}
MVC很新,我错过了什么?