Kindly assist me. I have and dataset and a report. The report loads well, but when i try to move to page two or click on an item in the group tree(postback), i am prompted to enter the login credetials. I am not sure of what is supposed to be placed in the
CrystalReportViewer1_Init event to correct this. i will be glad if someone points me to the right direction. Below is my code:
Thanks, i have removed the post back. The group tree click item list is now working fine, the only challenge remaining is that the next page does not go beyond page two.Any ideas? I appreaciate the time you are taking to guide me.
None
0 Points
5 Posts
Crystal report viewer not navigating to page two,dataset login prompt
Apr 26, 2012 11:06 AM|jkoross|LINK
Friends,
Kindly assist me. I have and dataset and a report. The report loads well, but when i try to move to page two or click on an item in the group tree(postback), i am prompted to enter the login credetials. I am not sure of what is supposed to be placed in the CrystalReportViewer1_Init event to correct this. i will be glad if someone points me to the right direction. Below is my code:
conn =new OracleConnection(ConfigurationManager.ConnectionStrings["db"].ConnectionString);
cmd =new OracleCommand("", conn);
da =new OracleDataAdapter();
da.SelectCommand = cmd;
ds =new DataSet();
rptDoc =new ReportDocument();
cmd.CommandType =CommandType.StoredProcedure;
CrystalReportViewer1.EnableDatabaseLogonPrompt =false;
if (!IsPostBack)
{
DsReports dsreport = new DsReports(); // .xsd file name
DataTable dt = new DataTable();
//set the name of data table
dt.TableName ="ViewBasics";
dt = getData();
dsreport.Tables[0].Merge(dt);
rptDoc.Load(Server.MapPath("~/Reports/basics.rpt"));
rptDoc.SetDataSource(dsreport);
CrystalReportViewer1.ReportSource = rptDoc;
}
}
public DataTable getData()
{
try
{
conn.Open();
cmd.Parameters.Clear();
cmd.CommandText ="GET_BASICS";
cmd.Parameters.Add(new OracleParameter("pcursor", OracleDbType.RefCursor)).Direction = ParameterDirection.Output;
da.Fill(ds);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
cmd.Dispose();
if (conn.State != ConnectionState.Closed)
conn.Close();
}
return ds.Tables[0];
}
protected void CrystalReportViewer1_Init(object sender, EventArgs e)
{
}
Contributor
6711 Points
2334 Posts
Re: Crystal report viewer not navigating to page two,dataset login prompt
Apr 27, 2012 02:00 AM|cnranasinghe|LINK
Just remove the if (!IsPostBack). Let the report to load every postback.
None
0 Points
5 Posts
Re: Crystal report viewer not navigating to page two,dataset login prompt
Apr 27, 2012 02:25 AM|jkoross|LINK
Thanks, i have removed the post back. The group tree click item list is now working fine, the only challenge remaining is that the next page does not go beyond page two.Any ideas? I appreaciate the time you are taking to guide me.
Contributor
6711 Points
2334 Posts
Re: Crystal report viewer not navigating to page two,dataset login prompt
Apr 27, 2012 02:33 AM|cnranasinghe|LINK
Try moving your code to Page_init method.
None
0 Points
5 Posts
Re: Crystal report viewer not navigating to page two,dataset login prompt
Apr 27, 2012 02:52 AM|jkoross|LINK
Phew!Thanks, it worked