日期:2014-05-18 浏览次数:20408 次
protected void Button1_Click(object sender, System.EventArgs e) { GetReport();//给报表绑定数据 lblCount.Text = ReportViewer1.LocalReport.GetTotalPages().ToString();//获取报表总页数 txtPage.Text = ReportViewer1.CurrentPage.ToString();//当前页 }
lblCount.Text = ReportViewer1.LocalReport.GetTotalPages().ToString(); txtPage.Text = ReportViewer1.CurrentPage.ToString();
//方法一: StatusBar bar = crystalReportViewer1.Controls[4] as StatusBar; string[] s = bar.Panels[1].Text.Split(':'); int total = Convert.ToInt32(s[1]); //方法二: ReportDocument rptDocument = (ReportDocument)crystalReportViewer1.ReportSource; CrystalDecisions.Shared.ReportPageRequestContext rprc = new CrystalDecisions.Shared.ReportPageRequestContext(); int totalPCount = rptDocument.FormatEngine.GetLastPageNumber(rprc);
------解决方案--------------------
你肯定帮顶成功了么 ?确认所有的数据都在么 ?数据验证过么
------解决方案--------------------
protected void Button1_Click(object sender, EventArgs e) { SqlConnection myConn = new SqlConnection("Data Source=192.168.0.36;Initial Catalog=Northwind;User ID=sa;Password=sa"); SqlDataAdapter myda = new SqlDataAdapter("Sales by Year", myConn); myda.SelectCommand.Parameters.AddWithValue("@Beginning_Date", "1997-10-10"); myda.SelectCommand.Parameters.AddWithValue("@Ending_Date", "2000-10-10"); myda.SelectCommand.CommandType = CommandType.StoredProcedure; DataSet myds = new DataSet(); myConn.Open(); myda.Fill(myds); myConn.Close(); ReportViewer1.Visible = true; ReportDataSource rds = new ReportDataSource("DataSet1_Sales_by_Year", myds.Tables[0]); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.Refresh(); }
------解决方案--------------------
txtPage.Text = ReportViewer1.CurrentPage.ToString();//当前页
之后还有些什么吗 ?
if(!IsPostBack)
有木有 。
------解决方案--------------------
听说绑定也有份拿!
------解决方案--------------------