Report Server Report add a mailto: link in the report rows

I am just getting familiar with report services and making a report with Business Intelligence. I think you can do the same with Report Builder 2.0 – if someone would comment I will update the post. I wanted to add a mailto: link with a subject. You are allowed in expressions, to use any .net function you want, but there is a way to do this.

Not every dll is included by default, and what I wanted to use was the System.Web.HttpUtility.UrlEncode() function. Here is the magic that makes it work:link.

In short, if you are a programmer you would normall put an Imports System.HttpUtilty at the top and then use the function with HttpUtility.UrlEncode()

If you do this, the Intellisense (when the code completes the strings for you) will kick in. This is how you know if it is working.

Basic Steps:

  1. Click menu Report->Report Properties
    1. what? no report menu? Ok – right mouse click in the area just outside the tablix and choose Report Properties
  2. Click References on the Left, then Add at the top and the … button to get a list
  3. Scroll down and include System.Web, click OK, then OK again
  4. Put a place holder in any cell by R-Click->Create Placeholder
  5. Click, THEN Right Mouse click on the placeholder and choose Placeholder Properties
    1. General Tab fill in the name, the text to show (might be an expression of =”my text here” and tooltip
    2. Action Tab: Choose “Goto URL” and fill the function listed below
    3. Format your text
  6. Click OK twice
  7. Click Build-Build Project_Name to see if it worked

[vb]

="mailto:me@mycompany.com?subject=" & System.Web.HttpUtility.UrlEncode("Topic:" & Fields!Topics_ID.Value & " " & Fields!TopicText.Value).ToString.Replace("+"," ") & "&body=" & System.Web.HttpUtility.UrlEncode("Q: " & Fields!Topics_ID.Value & "." & Fields!Questions_ID.Value & " " & Fields!QuestionText.Value & vbCrLf & vbCrLf).ToString.Replace("+"," ")

[/vb]