User-2072162984 posted
Hi
I created rdlc report with sub report
sub report event is not working.The cursor is not coming to event during debugging.If i run with out sub report,main report is working.
I have given the code below
ReportViewer1.Visible = true;
DataSet DataSet1 = new DataSet();
con = new SqlConnection(GetConnectionString());
con.Open();
ReportViewer1.LocalReport.SubreportProcessing +=new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
string strQryString = "SELECT CUSTOMERDETAILS.CustomerName,CUSTOMERDETAILS.CompanyName, Followup.CustomerNo, Followup.MeetingDate, Followup.MeetingType, Followup.Subject, Followup.MinutesofDiscussion, "
+ " frOM CUSTOMERDETAILS INNER JOIN"
+ " Followup ON CUSTOMERDETAILS.CustomerNo = Followup.CustomerNo INNER JOIN"
+ " USERDETAILS ON Followup.MailTo = USERDETAILS.UNo where Followup.MailTo=" + Session["UNo"] + "";
SqlCommand cmd1 = new SqlCommand(strQryString, con);
SqlDataAdapter da = new SqlDataAdapter(cmd1);
da.Fill(DataSet1);
ReportDataSource datasource = new ReportDataSource("DataSet1", DataSet1.Tables[0]);
this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report.rdlc");
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
void LocalReport_SubreportProcessing(object sender, Microsoft.Reporting.WebForms.SubreportProcessingEventArgs e)//cursor is not coming to this line
{
Fupid = Convert.ToInt32(e.Parameters[0].Values[0]);//passing the parameter
DataTable dt = getAttendies();//call function in sub report
e.DataSources.Add(new ReportDataSource("DataSet2",dt));
}
public DataTable getAttendies()
{
SqlConnection con = new SqlConnection(GetConnectionString());
con.Open();
string SqlQry = "select * from FOLLOWUPREQUESTCONTACTS where Fupid=" + Fupid + "";
DataTable dt = new DataTable();
SqlCommand sqlcmd = new SqlCommand(SqlQry, con);
SqlDataAdapter da = new SqlDataAdapter(sqlcmd);
da.Fill(dt);
return (dt);
}
Please help me.
Thanks
chandran