Calling methods like SetParameters isn’t cheap. Each call triggers a round trip to the report server. So it’s a call you want to minimize anyway. By only calling SetParameters during the initial GET request or only when parameter values have actually changed, you can improve the performance of your application and break the loop. A simple check of IsPostBack before calling SetParameters is usually sufficient.不能调用SetParameters, 或者只调用一次SetParameters
Reports Never Stop Loading With VS 2010
http://blogs.msdn.com/b/brianhartman/archive/2010/03/21/reports-never-stop-loading-with-vs-2010.aspx
呵呵,关键点在这第一句。
if (!IsPostBack)
{
ReportViewer1.ServerReport.ReportServerCredentials = new MyReportServerCredentials();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ban();
} }
public void ban()
{
pro_CityDataSetTableAdapters.CityTableAdapter city = new pro_CityDataSetTableAdapters.CityTableAdapter();
DataTable dt = city.GetData();
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report1.rdlc");
ReportDataSource data = new ReportDataSource("DataSet1", dt);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(data);
this.ReportViewer1.DataBind();
}