forum

Home / DeveloperSection / Forums / change forecolor af a special word in gridview cell

change forecolor af a special word in gridview cell

Anonymous User 1583 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?


c# c# 
Updated on 23-Jan-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By