title: Bold a string in c#
body: <p>I have a string and I need to add square braces and change the font to bold. Also I tried this and it doesn't wotk as expected.</p>
  
  <pre><code>string strID = "&lt;b&gt;" + strGroupID + "-&lt;/b&gt;";
  </code></pre>
  
  <p>Now this string produces result like this <code>Nestle-</code> and the result should be like this <strong><code>[Nestle]-</code></strong></p>
  
  <p>Really appreciate any help on this.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>protected void gvComm_RowCommand(object sender, GridViewCommandEventArgs e)
      {
          if (e.CommandName.Equals("AddNew"))
          {
              string strGroupID = ((DropDownList)gvComm.FooterRow.FindControl("ddlKey")).SelectedValue;
              string strComm = ((TextBox)gvComm.FooterRow.FindControl("lblOwner")).Text.Trim();
              string strLeader = ((TextBox)gvComm.FooterRow.FindControl("lblIT")).Text.Trim();
              string strName = ((TextBox)gvComm.FooterRow.FindControl("lblFTC")).Text.Trim();              
              string strID = "&lt;b&gt;" + strGroupID + "-&lt;/b&gt;";
              bool success = false;
              success = InsertComm(strGroupID , strComm, strLeader, strName , strID);                
              if (success)
              {
                  ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Data Inserted Successfully');window.location='Mapping.aspx';", true);
              }
              else
              {
                  ClientScript.RegisterStartupScript(Page.GetType(), "alert", "alert('Insert Operation Failed');window.location='Mapping.aspx';", true);
              }
          }
      }
  
  public static bool InsertComm(string strGroupID , string strComm, string strLeader, string strName , string strID)
      {
          bool success = false;
          string strcon = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
          using (SqlConnection connection = new SqlConnection(strcon))
          {
              connection.Open();
              using (SqlCommand oCommand = connection.CreateCommand())
              {
                  oCommand.CommandText = "insert into Comm values ('" + strGroupID + " " + 'N/A' + "','" + strComm+ "','" + strLeader+ "','" + strName + "','" + strID+ "')";
                  oCommand.ExecuteNonQuery();
                  success = true;
              }
          }
          return success;
      }
  </code></pre>
  
  <p>If you see strGroupID I will pass a N/A value. For Ex: The GroupID column value should be like</p>
  
  <pre><code>  [Nestle] - N/A where `[Nestle] -` only should be bold.
  </code></pre>