Binding sub report in Crystal report

Posted by Aijaz Chauhan on Stack Overflow See other posts from Stack Overflow or by Aijaz Chauhan
Published on 2014-06-11T09:22:16Z Indexed on 2014/06/11 9:24 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET