Click here to Skip to main content
15,905,414 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<pre lang="cs">public void ShowQueryBranchTATCrossed()
      {
          bool vFlag = false;

          try
          {
              rptViewer.Visible = true;
              //rptViewer.LocalReport.ReportPath="C:/Priya Working Folder/WorkingEnvironment/ILeverage2k10/ILeverage2k10/ILev_QueryBranchTATCrossedReport.rdlc";
              rptViewer.LocalReport.Refresh();

              vFlag = true;

          }
          catch (Exception Exp)
          {
              LogEvent(Exp);
              vFlag = false;
          }


          if (!vFlag)
          {
              ScriptManager.RegisterClientScriptBlock(this, typeof(string), "message", "alert('Unable to retrive the data, please contact system admin.');location.href='ILeverage_Blank.aspx'", true);
          }
      }

Posted

1 solution

Where? Which line?
Try and debug this code.
This error occurs when some object has not been instantiated and is null and we are trying to access an attribute or method inside it. Figure out which object is null and then initialize it.

It could be rptViewer.LocalReport.Refresh(); where you are trying to access Refresh() but LocalRepost may be null.
 
Share this answer
 
Comments
priya9826 8-Jun-11 0:38am    
this code is working in my system .In production ,it is throwing the error
Abhinav S 8-Jun-11 1:10am    
Ok then it looks like either some dlls required for the report may be missing or the path / url for the report may be getting messed up.
priya9826 13-Dec-12 10:42am    
Yes.That's true.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900