开发者

ASP.Net MVC 3 Razor Create Report

开发者 https://www.devze.com 2023-04-11 03:39 出处:网络
I have ASP.Net MVC3 project with Razor template, and I need to make a reporting tool for summary reports and detailed reports.

I have ASP.Net MVC3 project with Razor template, and I need to make a reporting tool for summary reports and detailed reports.

I do not know开发者_高级运维 how to create such reports in MVC3. Could anyone give me an example for creating these reports?


There isn't a built-in control for reports, there is however an HTML helper for displaying charts. Please see example here

SSRS reports are not supported by default in MVC 3, therefore you need to use a report viewer control. Article explaning how to do this can be found here


first, i must configure the dataset in my project. because i use storedprocedure, so i must add new table adapter in my dataset.

then i add new item (for the report file) in my project and design the report using report wizard.

after that, for showing the report in my project, i add new web form and in my web form, drag the report viewer and script manager. choose the design view to set up the report.

<body>
<form id="form1" runat="server">
<div>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

    <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" SizeToReportContent="true" 
        Font-Size="8pt" InteractiveDeviceInfos="(Collection)" 
        WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
        <LocalReport ReportPath="Reports\rptbooking.rdlc">
            <DataSources>
                <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
            </DataSources>
        </LocalReport>
    </rsweb:ReportViewer>

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
        TypeName="rptBatchClose.RDYGetawayDataSetTableAdapters.DataTable1TableAdapter">
    </asp:ObjectDataSource>

</div>
</form>
</body>

this is the simple way to make SSRS report in my MVC3 Project.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号