我有以下问题。我想用@Html.ReportViewer创建3x3表(或视图)。我想不滚动显示所有报告。

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

ReportViewer rptViewer =新的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();


这是我的视图代码和视图,如下所示:
c# - 如何在 bootstrap 中正确显示报告(Html.ReportViewer)?-LMLPHP

<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>


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

最佳答案

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

<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>

关于c# - 如何在 bootstrap 中正确显示报告(Html.ReportViewer)?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38656413/

10-11 05:37