如何在c#mvc中查看RDLC报告 [英] How to view RDLC report in c# mvc

查看:97
本文介绍了如何在c#mvc中查看RDLC报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

我想在我的视图(.cshtml)中显示RDLC报告。



我有数据模型。所以我想在报告上显示它们。



// ----------------------- --------

控制器动作

------------------------ ------------

  public  ActionResult ViewRemmitReportList( int 期间,字符串 fromDate, string  toDate)
{
var creditorId = Crypto.Decrypt(Convert.ToString(Session [ CreditorId]));
USCPIService uscpService = new USCPService();
var finalRemitDto = uscpService.GetFinalRemmitDtoResult(creditorId,period.ToString(),fromDate,toDate);
ReportViewer reportViewer = LoadRemmitReport(finalRemitDto,fromDate,toDate);
ViewBag.ReportViewer = reportViewer;
return PartialView( _ RemmitReportResult);
}





之后查看文件如下,

------- -----------------------------------

@using ReportViewerForMvc

@model US.BOX.CreditorPortal.Web.Model.ReportResultModel



< div id =   reportView  class  =  表格响应 >  
< iframe width = 100% height = 300px name = iframe_a < span class =code-keyword>>
@ Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer, new {scrolling = yes,width = 100%})
< / iframe >
< / div >





就是这样。但我只会显示Iframe。没有详细信息。

请帮我在视图中显示它们。

我已经尝试了2天以上。

谢谢大家。

解决方案

这不是 < iframe> 标记 [ ^ ]有效。您不能只在标记内呈现内容 - 您必须将 src 属性设置为要显示的文档的地址,或者设置 srcdoc 属性为您要显示的文档的HTML。



假设您正在使用此图书馆 [ ^ ],您根本不需要< iframe> 标记。 ReportViewer 方法将为您处理:

  <   div     id   =  reportView    class   = 表格响应 >  
@ Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer,new {scrolling =yes,width =100%})
< / div >


Hi
I want to display a RDLC report in my view (.cshtml).

I have Data model with data. So i want to display them on report.

//-------------------------------
Controller action
------------------------------------

public ActionResult ViewRemmitReportList(int period, string fromDate, string toDate)
        {
            var creditorId = Crypto.Decrypt(Convert.ToString(Session["CreditorId"]));
            USCPIService uscpService = new USCPService();
            var finalRemitDto = uscpService.GetFinalRemmitDtoResult(creditorId, period.ToString(), fromDate, toDate);
            ReportViewer reportViewer = LoadRemmitReport(finalRemitDto,fromDate, toDate);
            ViewBag.ReportViewer = reportViewer;
            return PartialView("_RemmitReportResult");
        }



After that view file as following,
------------------------------------------
@using ReportViewerForMvc
@model US.BOX.CreditorPortal.Web.Model.ReportResultModel

<div id="reportView" class="table-responsive">
    <iframe width="100%" height="300px" name="iframe_a">       
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer, new {scrolling = "yes", width = "100%"})        
    </iframe>
</div>



So that's it. But I will display only Iframe. no details.
Please help me to display them on view.
I have tried more than 2 days.
Thanks all.

解决方案

That's not how the <iframe> tag[^] works. You can't just render content within the tag - you have to either set the src attribute to the address of the document you want to display, or set the srcdoc attribute to the HTML of the document you want to display.

Assuming you're using this library[^], you don't need the <iframe> tag at all. The ReportViewer method will take care of that for you:

<div id="reportView" class="table-responsive">
    @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer, new {scrolling = "yes", width = "100%"})        
</div>


这篇关于如何在c#mvc中查看RDLC报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆