Hi there, i had the same problem this how i managed to solve it. Pay attention to the first DataSet(getRpt) and how it is used within the following events 1.Page_init;2.Page_Load;3.CrystalReportViewr_Page_Init;4.CrystalReportViewrNavigate heres my Full code
DataSet getRpt()
{
CrystalReport2 myRpt = new CrystalReport2()
string myConstr = ConfigurationManager.AppSettings["ConnectionString"]
SqlConnection myConnection = new SqlConnection(myConstr)
SqlDataAdapter myAdapter = new SqlDataAdapter()
DataSet3 myDataSet = new DataSet3()
SqlCommand MyCommand = myConnection.CreateCommand()
try
{
CrystalReportViewer1.DisplayGroupTree = false
CrystalReportViewer1.DisplayToolbar = true
MyCommand.CommandText = "ProcNamet"
MyCommand.CommandType = CommandType.StoredProcedure
myAdapter.SelectCommand = MyCommand
myAdapter.SelectCommand.Parameters.Add(new SqlParameter("@myPara1",Convert.ToInt32(txtDays.Text)))
myAdapter.SelectCommand.Parameters.Add(new SqlParameter("@myPara2", Convert.ToString(DropDownList1.SelectedValue)))
myAdapter.SelectCommand.Parameters.Add(new SqlParameter("@myPara3", Convert.ToString(DropDownList2.SelectedValue)))
myAdapter.Fill(myDataSet, "ProcName")
myRpt.SetDataSource(myDataSet)
CrystalReportViewer1.ReportSource = myRpt
}
catch (Exception ex)
{
string strEX
strEX = ex.ToString()
}
return myDataSet
}
private void Page_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataSet myD = getRpt()
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataSet myD = getRpt()
}
}
protected void btnPreview_Click(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataSet myD = getRpt()
}
}
protected void CrystalReportViewer1_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataSet myD = getRpt()
}
}
protected void CrystalReportViewer1_Navigate(object source, CrystalDecisions.Web.NavigateEventArgs e)
{
if (!IsPostBack)
{
DataSet myD = getRpt()
}
}