本文介绍了如何在引导程序中正确显示报告 (Html.ReportViewer)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题.我想创建带有 @Html.ReportViewer 的 3x3 表(或视图).我想在没有卷轴的情况下显示所有报告.

我的控制器中有以下代码:

ReportViewer rptViewer = new ReportViewer();

 rptViewer.ProcessingMode = ProcessingMode.Remote;rptViewer.SizeToReportContent = true;rptViewer.ZoomMode = ZoomMode.FullPage;rptViewer.AsyncRendering = false;//Dodatki okna:rptViewer.ShowBackButton = false;rptViewer.ShowExportControls = false;rptViewer.ShowFindControls = false;rptViewer.ShowPageNavigationControls = false;rptViewer.ShowPrintButton = false;rptViewer.ShowRefreshButton = false;rptViewer.ShowZoomControl = false;rptViewer.ServerReport.ReportServerUrl = new Uri("MyServerAddress");rptViewer.ServerReport.ReportPath = "MyReportPath";rptViewer.ServerReport.ReportServerCredentials = new ReportViewerCredentials("MyCredentials");ViewBag.ReportViewer = rptViewer;返回视图();

这是我的视图代码和视图:

<div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)

<div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)

<div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)

<div class="row"><div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer 作为 Microsoft.Reporting.WebForms.ReportViewer)

<div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)

<div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)

<div class="row"><div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)

<div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer 作为 Microsoft.Reporting.WebForms.ReportViewer)

<div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)

只有最后一个元素没有滚动.其余的是带有卷轴的小窗户.如何解决这种情况?我可以用 ReportViewer 元素做一个漂亮的视图吗?

解决方案

我在视图中添加了以下代码,它解决了一个问题:

@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer, new { frameborder = "0", width = "500", height = "500", style = "overflow:hidden;", scrolling = "no" })

<div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer1 as Microsoft.Reporting.WebForms.ReportViewer, new { frameborder = "0", width = "500", height = "500", style = "overflow:hidden;", scrolling = "no" })

<div class="col-md-4">@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer, new { frameborder = "0", width = "500", height = "500", style = "overflow:hidden;", scrolling = "no" })

I have a following problem. I want to create 3x3 table(or view) with @Html.ReportViewer inside. I want to display all of report without a scrolls.

I have following code in my controller:

ReportViewer rptViewer = new ReportViewer();

        rptViewer.ProcessingMode = ProcessingMode.Remote;
        rptViewer.SizeToReportContent = true;
        rptViewer.ZoomMode = ZoomMode.FullPage;

        rptViewer.AsyncRendering = false;

        //Dodatki okna:
        rptViewer.ShowBackButton = false;
        rptViewer.ShowExportControls = false;
        rptViewer.ShowFindControls = false;
        rptViewer.ShowPageNavigationControls = false;
        rptViewer.ShowPrintButton = false;
        rptViewer.ShowRefreshButton = false;
        rptViewer.ShowZoomControl = false;

        rptViewer.ServerReport.ReportServerUrl = new Uri("MyServerAddress");
        rptViewer.ServerReport.ReportPath = "MyReportPath";

        rptViewer.ServerReport.ReportServerCredentials = new ReportViewerCredentials("MyCredentials");


        ViewBag.ReportViewer = rptViewer;
        return View();

And this is my view code and view as I see:

<div class="row">
    <div class="col-md-4">
       @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
    </div>
    <div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
    </div>
    <div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
    </div>
</div>

<div class="row">
    <div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
    </div>
    <div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
    </div>
    <div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
    </div>
</div>

<div class="row">
    <div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
    </div>
    <div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
    </div>
    <div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
    </div>
</div>

Only the last element is without scrolls. The rest are a small windows with scrolls. How to fix this situation? Can I do a nice view with ReportViewer elements?

解决方案

I have added a following code into my view it solved a problem:

<div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer, new { frameborder = "0", width = "500", height = "500", style = "overflow:hidden;", scrolling = "no" })
</div>
<div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer1 as Microsoft.Reporting.WebForms.ReportViewer, new { frameborder = "0", width = "500", height = "500", style = "overflow:hidden;", scrolling = "no" })
</div>
<div class="col-md-4">
        @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer, new { frameborder = "0", width = "500", height = "500", style = "overflow:hidden;", scrolling = "no" })
</div>

这篇关于如何在引导程序中正确显示报告 (Html.ReportViewer)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 22:50