我对ASP.NET ReportViewer如何呈现报表有疑问。右上角的文本框的写入模式设置为Rotate270,但未在Chrome版本中获取。似乎还有其他一些小问题,但这个明显的问题确实是我的主要问题。我可以在报表查看器上设置一个设置,以帮助它与每个浏览器更兼容吗?
HTML:
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption">
<span class="h4 caption-subject font-blue-steel bold uppercase">Preview</span>
</div>
</div>
<div class="portlet-body">
<iframe id="reportViewerFrame" style="width: 100%; margin: 0px;" frameborder="0" scrolling="no" onload="autoResize('reportViewerFrame')"></iframe>
</div>
</div>
加载预览的脚本:
$('.preview-button').on('click', function () {
var labelID = $('#SelectedFederalLabel').val();
var labelCount = $('#LabelsToPrint').val();
var leftMargin = $('#LeftMargin').val();
var topMargin = $('#TopMargin').val();
var firstLabelPosition = $('#startOnLabelSliderValue').text();
var vehicleID = $('#VehicleID').val();
var url = "../../Reports/LabelViewerHost.aspx?mode=preview" +
"&vehicleID=" + vehicleID +
"&labelID=" + labelID +
"&firstLabelPosition=" + firstLabelPosition +
"&labelCount=" + labelCount +
"&leftMargin=" + leftMargin +
"&topMargin=" + topMargin;
var reportViewerFrame = document.getElementById('reportViewerFrame');
if (reportViewerFrame.src) {
reportViewerFrame.src = url;
} else if (reportViewerFrame.contentWindow !== null && reportViewerFrame.contentWindow.location !== null) {
reportViewerFrame.contentWindow.location = url;
} else {
reportViewerFrame.setAttribute('src', url);
}
$(".preview-section").slideDown();
});
LabelViewerHost.aspx.cs Page_Load事件(C#):
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
return;
}
_queryParameters =
HttpUtility.ParseQueryString(
HttpContext.Current.Request.QueryString.ToString());
string mode = _queryParameters.Get("mode");
ReportGenerationMode reportGenerationMode =
(string.IsNullOrEmpty(mode) || mode == "preview") ?
ReportGenerationMode.Preview :
ReportGenerationMode.Print;
...
Parse Query Parameters
...
try
{
Microsoft.Reporting.WebForms.ReportViewer reportViewer =
reportGenerationMode == ReportGenerationMode.Preview ?
PreviewReportViewer :
new Microsoft.Reporting.WebForms.ReportViewer();
reportViewer.Reset();
reportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
reportViewer.LocalReport.ReportPath = Server.MapPath(_federalLabel.ReportFile);
#region Set report parameters
reportViewer.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("LabelsToPrint", _labelCount.ToString()));
... // I do this more
#endregion Set report parameters
reportViewer.LocalReport.Refresh();
}
catch (Exception ex)
{
// TODO
}
}