locked
add a "*" to gridview header text RRS feed

  • Question

  • User161781117 posted

    I want to add a "*" to gridview header text programatically on ceratin conditions.. Problem is i can add "*" but i cant set the fore color to red.. if i do something like the "*" still remains black...I dont want to complete header label to be red..i know how to do that ..i only want asterisk to be RED... how do i achieve this behavior?

    foreach (GridViewRow R in gridFR.Rows)
    {

    Label asterisk = new Label();
    asterisk.ForeColor = System.Drawing.Color.Red;
    asterisk.Text = "*";
    gridFR.HeaderRow.Cells[1].Text = " Description" + asterisk.Text;

    }

     

    Saturday, July 7, 2012 11:12 PM

Answers

  • User1211441112 posted
    Try this
    foreach (GridViewRow R in gridFR.Rows)
    {
      Label asterisk = new Label();
      asterisk.Text = "*";
      gridFR.HeaderRow.Cells[1].Text = "Description <span style=\"color: red\">" + asterisk.Text + "</span>";
    }
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 8, 2012 3:48 AM