- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前在使用 Report Viewer 控件时遇到问题。我当前的项目是一个 MVC3 应用程序,我在其中链接了一个带有 Report Viewer 控件的 aspx 页面。该页面显示,但是,我根本无法翻阅结果。这是我的代码。
报表.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Report.aspx.cs" Inherits="SOSNG.Reports.Report" %>
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<title>Report Viewer</title>
<link rel="stylesheet" href="../Content/Site.css"" type="text/css" />
</head>
<body>
<noscript><div class="noScript"><span class="errorMessage"></span>- This application works best with Javascript enabled.</div></noscript>
<div class="page">
<div id="MastHead">
<div id="MastHeadLeft"></div>
<%--<h1 id="ApplicationName"><span class="Skip"></span></h1>--%>
<div id="MastHeadRight"></div>
<div id="MasterMenu" class="clear">
</div>
</div>
<div id="MainPalette">
<div class="SubPalette"><h3 class="PaletteName"></h3>
<div class="SubPaletteContent">
<br />
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div>
<rsweb:ReportViewer ID="SOSNGReportViewer" runat="server" AsyncRendering="False"
Height="100%" SizeToReportContent="False" Width="100%" ZoomPercent="100"
Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(Collection)"
WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt"
ProcessingMode="Remote" ShowParameterPrompts="false">
</rsweb:ReportViewer>
</div>
</form>
</div>
</div>
</div>
<div id="Footer">
<div id="FooterSpan"></div>
<div id="FooterLeft"></div>
<div id="FooterRight"></div>
</div>
</div>
</body>
</html>
报表.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
//Report Type
var reportType = (string)Session["ReportType"];
//Search parameters
var searchFBINumber = string.Empty;
var searchVlanId = string.Empty;
var searchNetworkDevice = string.Empty;
var searchMACAddress = string.Empty;
var searchLocation = string.Empty;
var searchIPAddress = string.Empty;
var searchComment = string.Empty;
//Server Report setup
var serverReport = SOSNGReportViewer.ServerReport;
serverReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServer"]);
serverReport.ReportPath = ConfigurationManager.AppSettings["ReportDirectory"] + reportType;
Microsoft.Reporting.WebForms.ReportParameter[] RptParameters;
//Switch on Report
switch (reportType)
{
case "CommentReport":
searchComment = (string)Session["Comment"];
if (!string.IsNullOrEmpty(searchComment))
{
RptParameters = new ReportParameter[1];
RptParameters[0] = new ReportParameter("Comment", searchComment);
this.SOSNGReportViewer.ServerReport.SetParameters(RptParameters);
this.SOSNGReportViewer.ServerReport.Refresh();
}
break;
case "FBINumberReport":
searchFBINumber = (string)Session["FBINumber"];
if (!string.IsNullOrEmpty(searchFBINumber))
searchFBINumber = null;
RptParameters = new ReportParameter[1];
RptParameters[0] = new ReportParameter("FBINumber", searchFBINumber);
this.SOSNGReportViewer.ServerReport.SetParameters(RptParameters);
this.SOSNGReportViewer.ServerReport.Refresh();
break;
case "IPAddressReport":
searchIPAddress = (string)Session["NetworkIPAddress"];
if (!string.IsNullOrEmpty(searchIPAddress))
{
RptParameters = new ReportParameter[1];
RptParameters[0] = new ReportParameter("IPAddress", searchIPAddress);
this.SOSNGReportViewer.ServerReport.SetParameters(RptParameters);
this.SOSNGReportViewer.ServerReport.Refresh();
}
break;
case "LocationReport":
searchLocation = (string)Session["Location"];
if (!string.IsNullOrEmpty(searchLocation))
searchLocation = null;
RptParameters = new ReportParameter[1];
RptParameters[0] = new ReportParameter("Location", searchLocation);
this.SOSNGReportViewer.ServerReport.SetParameters(RptParameters);
this.SOSNGReportViewer.ServerReport.Refresh();
break;
case "MACAddressReport":
searchMACAddress = (string)Session["MACAddress"];
if (!string.IsNullOrEmpty(searchMACAddress))
searchMACAddress = null;
RptParameters = new ReportParameter[1];
RptParameters[0] = new ReportParameter("MACAddress", searchMACAddress);
this.SOSNGReportViewer.ServerReport.SetParameters(RptParameters);
this.SOSNGReportViewer.ServerReport.Refresh();
break;
case "NetworkDeviceReport":
searchNetworkDevice = (string)Session["NetworkDevice"];
if (!string.IsNullOrEmpty(searchNetworkDevice))
searchNetworkDevice = null;
RptParameters = new ReportParameter[1];
RptParameters[0] = new ReportParameter("NetworkDevice", searchNetworkDevice);
this.SOSNGReportViewer.ServerReport.SetParameters(RptParameters);
this.SOSNGReportViewer.ServerReport.Refresh();
break;
case "VlanNumberReport":
searchVlanId = (string)Session["VlanId"];
if (!string.IsNullOrEmpty(searchVlanId))
{
RptParameters = new ReportParameter[1];
RptParameters[0] = new ReportParameter("VlanId", searchVlanId);
this.SOSNGReportViewer.ServerReport.SetParameters(RptParameters);
this.SOSNGReportViewer.ServerReport.Refresh();
}
break;
default:
break;
}
}
最佳答案
我想通了。我需要在开始时对 !IsPostBack 进行检查。每个 PostBack 只是重新绑定(bind)数据并重置控件。应该知道这很简单。
关于asp.net - 分页在报表查看器中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22310260/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!