title: New to RDLC integration to MVC View #Error when rendering some fields
body: <p>I have recently created my first RDLC report using Visual Studio 2010 to my MVC application.</p>
  
  <p>I used Report Wizard to create Report1.rdlc and I run the following controller code to render output to a PDF.</p>
  
  <p>My data source when the report runs references Site Object in my Model. Everything runs fine but 2 of the 4 columns in the output are rendered as #Error</p>
  
  <p>Both columns have data in them for every record, there are no nulls</p>
  
  <p>The only thing that makes the 2 #Error columns different from the ones that render is that they are a level down the model. i.e. of the 4 columns :</p>
  
  <p>1st field SiteDescription renders OK
  2nd field SiteOperator renders value as #Error for each row
  3rd field SiteStatus renders value as #Error for each row
  4th field CapacityMW renders OK</p>
  
  <p>NB: SiteOperator is Site.SiteOperator.Operator. Similar for 3rd field. The 1st and forth are fields in the Site table (i.e. top level of model in this case)</p>
  
  <p>QUESTION: Is there something else developer has to do to allow RDLC to work with existing objects from the Model? i.e. I noticed the report wizard creates a Report1.rdlc.xml file, perhaps this has to be modified, I have ran out of ideas on this one. Any comments greatly appreciated</p>
  
  <p>Here is my controller code :</p>
  
  <pre><code>        private void RenderReport(string ReportPath, object Model)
      {
  
          var localReport = new LocalReport { ReportPath = ReportPath };
  
          var reportDataSource = new ReportDataSource("DataSet1", Model);
          localReport.DataSources.Add(reportDataSource);
  
          var reportType = "PDF";
          string mimeType;
          string encoding;
          string fileNameExtension;
  
          //The DeviceInfo settings should be changed based on the reportType
          //http://msdn2.microsoft.com/en-us/library/ms155397.aspx
          string deviceInfo =
          "&lt;DeviceInfo&gt;" +
          "  &lt;OutputFormat&gt;PDF&lt;/OutputFormat&gt;" +
          "  &lt;PageWidth&gt;8.5in&lt;/PageWidth&gt;" +
          "  &lt;PageHeight&gt;11in&lt;/PageHeight&gt;" +
          "  &lt;MarginTop&gt;0.5in&lt;/MarginTop&gt;" +
          "  &lt;MarginLeft&gt;1in&lt;/MarginLeft&gt;" +
          "  &lt;MarginRight&gt;1in&lt;/MarginRight&gt;" +
          "  &lt;MarginBottom&gt;0.5in&lt;/MarginBottom&gt;" +
          "&lt;/DeviceInfo&gt;";
  
          Warning[] warnings;
          string[] streams;
          byte[] renderedBytes;
  
          //Render the report
          renderedBytes = localReport.Render(
              reportType,
              deviceInfo,
              out mimeType,
              out encoding,
              out fileNameExtension,
              out streams,
              out warnings);
  
          //Clear the response stream and write the bytes to the outputstream
          //Set content-disposition to "attachment" so that user is prompted to take an action
          //on the file (open or save)
          Response.Clear();
          Response.ContentType = mimeType;
          Response.AddHeader("content-disposition", "attachment; filename=foo." + fileNameExtension);
          Response.BinaryWrite(renderedBytes);
          Response.End();
      }
  </code></pre>