title: Sticking HTML formatting into System.String object in C#
body: <p>How do I stick HTML formatting into a String object in C#?</p>
  
  <p>Here's what I have:</p>
  
  <pre><code>c.DepartmentAbbr.ToString() + " - (" + c.DepartmentName.ToString() + ")"
  </code></pre>
  
  <p>where c.DepartmentAbbr.ToString() and c.DepartmentName.ToString() are both fields being selected from a data context using LINQ.</p>
  
  <p>Here's what I essentially want:</p>
  
  <pre><code>"&lt;b&gt;" + c.DepartmentAbbr.ToString() + "&lt;/b&gt; - (" + c.DepartmentName.ToString() + ")"
  </code></pre>
  
  <p>so that the first word shows up in bold.  The above just shows the literal text with the bold tags and everything.  I assume I will need to use String.Format but I can't quite find a good example that helps me know how to use it to do what I want.</p>
  
  <h2>Update</h2>
  
  <p>Here are a few more details that I didn't think were important but I think by now they must be.</p>
  
  <p>Here is the control I'm using. ASPX code:</p>
  
  <pre><code> &lt;telerik:RadComboBox ID="rcbDepartments" runat="server" AppendDataBoundItems="True"
          AutoPostBack="true" NoWrap="true" Width="250px"&gt;
          &lt;Items&gt;
              &lt;telerik:RadComboBoxItem Text="All Departments" Value="-1" /&gt;
          &lt;/Items&gt;
      &lt;/telerik:RadComboBox&gt;
  </code></pre>
  
  <p>And I'm adding items to this control using LINQ in C#:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (!IsPostBack)
      {
          var abbr = from c in DB.Departments
                     where c.DepartmentAbbr != "BInst"
                     select c;
  
          foreach (var c in abbr)
          {
              String s = String.Format("{0} - ({1})", c.DepartmentAbbr, c.DepartmentName);
              rcbDepartments.Items.Add(new RadComboBoxItem(s, c.DepartmentID.ToString()));
          }
      }
  }
  </code></pre>
  
  <p>The RadComboBoxItem object accepts either (), (String text), or (String text, String value), and I am using the latter.</p>