问题描述
我是菜鸟,一个ASPX页面插入reportview控件,浏览该页面的时候是空白的没有显示报表控件和数据?问题在哪啊?折腾我好几天了!具体代码:该页面前台:<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="mPrintPage.aspx.cs"Inherits="mPrintPage"%><%@Registerassembly="Microsoft.ReportViewer.WebForms,Version=10.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"namespace="Microsoft.Reporting.WebForms"tagprefix="rsweb"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title>打印预览</title></head><body><formid="form1"runat="server"><div><rsweb:ReportViewerID="ReportViewer1"runat="server"Height="100%"Width="100%"></rsweb:ReportViewer><asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager></div></form></body></html>
该页面后他usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingMicrosoft.Reporting.WebForms;usingSystem.Data;usingSystem.Configuration;publicpartialclassmPrintPage:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){if(!IsPostBack){stringtableName=Session["PrintTableName"].ToString();if(tableName=="DateTableRep")PrintStationDaySta();}}protectedvoidPrintStationDaySta(){stringstrStationDaySta=ConfigurationManager.AppSettings["StationDaySta"].ToString();stringmStartDayTime="";stringmEndDayTime="";decimaltotalWeight=0,totalAmount=0;if(Session["startdaytime"].ToString()!=null){mStartDayTime=Session["startdaytime"].ToString();}if(Session["enddaytime"].ToString()!=null){mEndDayTime=Session["enddaytime"].ToString();}DataTabledt=newDataTable();/*if(Session["PrintSqlTect"].ToString()!=null){stringsql=Session["PrintSqlTect"].ToString();ZSqlzsql=newZSql();zsql.Open(sql);dt=zsql.m_table;}*///totalWeight=(decimal)Session["WeightVal"];//totalAmount=(decimal)Session["AmountVal"];;dt.Clear();dt=(DataTable)Session["PrintTableDate"];ReportViewer1.LocalReport.ReportPath=strStationDaySta;ReportViewer1.LocalReport.DataSources.Clear();ReportViewer1.LocalReport.DataSources.Add(newReportDataSource("dtDayStaMsg",dt));stringStrTable=Session["PrintTable"].ToString();stringStrTime="统计时间:"+mStartDayTime+"~"+mEndDayTime;stringStrVal=Session["PrintLjVal"].ToString();ReportParameterRpTable=newReportParameter("ReportParameterTable",StrTable);ReportViewer1.LocalReport.SetParameters(newReportParameter[]{RpTable});ReportParameterRpTime=newReportParameter("ReportParameteTime",StrTime);ReportViewer1.LocalReport.SetParameters(newReportParameter[]{RpTime});ReportParameterRpVal=newReportParameter("ReportParameterVal",StrVal);ReportViewer1.LocalReport.SetParameters(newReportParameter[]{RpVal});ReportViewer1.LocalReport.Refresh();}
打开该页面:stringurl="mPrintPage.aspx";Response.Redirect(url);
解决方案
解决方案二:
你建ReportViewer1这个报表文件没有?
解决方案三:
Refer&tryit:
解决方案四:
引用1楼aigel的回复:
你建ReportViewer1这个报表文件没有?
有报表的!绝对
解决方案五:
哪位大侠指点一下啊搞不定我就要下岗了!
解决方案六:
PrintStationDaySta();单独放到Page_Load里报错吗
解决方案七:
引用5楼aigel的回复:
PrintStationDaySta();单独放到Page_Load里报错吗
没有啊