Setting text to bold in Table heading

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • E11esar
    New Member
    • Nov 2008
    • 132

    Setting text to bold in Table heading

    Hi there.

    I am dynamically creating a table within my ASP.Net (C#) page and adding this to an ASP Panel, using the command
    Code:
    PanelBlocksSecurity.Controls.Add(dTable);
    I can get everything working correctly but my table headings are in normal case, whereas I would like them in bold font.

    An example of one of my commands to add a header column is as follows:
    Code:
    HtmlTableCell headerCell2 = new HtmlTableCell();
    headerCell2.InnerText = "Select"; 
    headerRow.Controls.Add(headerCell2);
    The question hence is how do I set the text "Select" above so that it is bold please? I have a feeling this is very easy to do but for some reason it is not registering in my brain at the moment..!

    Thank you.

    Mark :o)
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    You could use the style property of the HtmlTableCell to set the style to bold:
    Code:
    headerCell2.Style.Add("font-weight","bold");

    Comment

    • E11esar
      New Member
      • Nov 2008
      • 132

      #3
      Solution

      Thank you for that. Looks so easy now when you see the answer.

      M :o)

      Comment

      Working...