Thursday, July 24, 2014

ReportViewer control not loading correctly in chrome

When viewing the ReportViewer control in Google Chrome, an issue occurs where the ReportViewer toolbar is visible, a loading box appears, but the report content does not load. This is an issue with the div that contains the actual report not being visible.

Setting the width and height of the ReportViewer control itself, will correct this issue, but this is not ideal for dynamic reports where the dimensions can change. I have found that by setting Width/Height to 100% and SizeToReportContent to true, the report will load correctly.
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="100%" Height="100%" SizeToReportContent="True" />

Tuesday, July 1, 2014

Transactions and Entity Framework using TransactionScope

Sometimes you may wish to make a series of database calls in Entity Framework, but may need to reverse these calls if any single one fails. This can be accomplished using TransactionScope and try/catch.
    using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.RequiresNew, transOptions))
  // EF calls here