ReportViewer: Display text as bold using HTML markup

I am trying to display a single word inside a larger text area as bold.  (Silly requirements.)  I have not been able to figure out if there is a way to do this within a standard express.  So far all my research has turned up is that I should try to turn markup on for that text box and use HTML markup.  Although, even that only has a limited set of supported tags

First I needed to turn markup on for the textbox.  Here are the instructions I found on this asp.net forum answer.

  1. If the Toolbox is not visible, click Toolbox on the View menu.
  2. Double-click or drag a Textbox report item to the design surface.
  3. Drag a field from your dataset into the text box. A placeholder is created for your field.
  4. Right-click the placeholder (<>), and then click Placeholder Properties.
  5. On the General tab, verify that the Value box contains an expression that evaluates to the field you dropped in step 3.
  6. Click HTML – Interpret HTML tags as styles. This causes the field to be evaluated as HTML.
  7. Click OK.

To manually change it without using the UI tools add the tag “HTML” into the xml.

markup

Finally, I rewrote the text in the textbox to be formatted with html instead of the rdlc formatting. It was a pain to do but in the end will be more flexible and maintainable.

ReportViewer: Alternating color on rows

According to MSDN you do the following:

Creating a Green-Bar Report To apply a green-bar effect (alternating colors every other row) to a table in a report, use the following expression in the BackgroundColor property of each text box in the detail row:

=iif(RowNumber(Nothing) Mod 2, "PaleGreen", "White")

To alternate colors by row groupings:

=iif(RunningValue({Expression Being Grouped On}, CountDistinct, nothing) Mod 2, "WhiteSmoke", "White")

ReportViewer: Displaying an empty row on a table

We use Microsoft’s ReportViewer for our reporting needs.  It isn’t the most elegant but it does the job.

Recently I needed to display a table on a report with an empty row if there was no data in the data source.  This is a visual indicator on the report that there is no data for that item.  Here are the instructions on the way that I found to do this.

1.  Right click on the data row in the table
2.  Add a new row below it, outside of the group.
3.  Right click on the row and select row visibility
4.  Click the radio button for “Show or hide based on expression”
5.  Enter code similar to the following as the expression:

=IIF(Sum(Fields!Id.Value, "DataSetName") &gt; 0, true, false)

This will show the row empty if there is no data and hide it if there is data.  Not very elegant but will do the job.