Binding sub report in Crystal report
- by Aijaz Chauhan
Is it compulsory to bind sub report if we put sub report in main report ?
here is my problem :
code snippet :
DataTable dtExtraDoc = dtDocSub.Select("DocumentId=14").Length == 0 ? null : dtDocSub.Select("DocumentId=14").CopyToDataTable();
if (dtExtraDoc != null && dtExtraDoc.Rows.Count > 0)
{
if (dtExtraDoc.Rows[0]["ResponceId"].ToString() == "2")
{
repdoc.Subreports["subRpt-extra-Doc-textile-claim-query-letter.rpt"].SetDataSource(dtExtraDoc);
}
}
If dtExtraDoc is null then it will not bind the sub report and hence it gives me error
" Object reference not set to an instance of object"
I am totally new to crystal reports please help me..
Thanks in advance.