How can I change the color of specific keywords in a gridview cell without affecting all words? Here is the sample code:
protected void gvContents_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[3].Text.Contains("Special"))
{
//Set only the "Special" keyword to red
}
else if (e.Row.Cells[3].Text == "Perishable")
{
//Set only the "Perishable" keyword to blue
}
else if (e.Row.Cells[3].Text == "Danger")
{
//Set only the "Danger" keyword to yellow
}
}
}
The text within the cell could be something like: Radioactive : Danger
or this: Human Body : Special ,Perishable
. What steps should I take?