Users Pricing

forum

Home Forums change forecolor af a special word in gridview cell – MindStick

change forecolor af a special word in gridview cell

Anonymous User 1957 22 Jan 2014

I want to change a color of a special word NOT all words of a gridview Cell . here is event and codes:

protected void gvContents_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        if (e.Row.Cells[3].Text.Contains("Special"))
        {
            //set The "Special" word only forecolor to red
        }
        else if (e.Row.Cells[3].Text == "Perishable")
        {
            //set The "Perishable" word only forecolor to blue
        }
        else if (e.Row.Cells[3].Text == "Danger")
        {
            //set The "Danger" word only forecolor to yellow
        }
    }
}

and Cell text might be like here :"Radioactive : Danger" or this : "Human Body : Special ,Perishable " what should I do?


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md