I have a gridview that displays data from a DB... Currently I can only change colors of all the texts in a cell, but what I need to do is to change the color of certain texts only. Is there a way to do this? Is this possible? Im just a newbie so please be patient with me..
This is my function for changing color of texts in cells:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (_SearchKey != string.Empty)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
for (int ctr = 0; ctr < e.Row.Cells.Count; ctr++)
{
if (e.Row.Cells[ctr].Text.ToLower().Contains(_SearchKey.ToLower()))
{
e.Row.Cells[ctr].ForeColor = System.Drawing.Color.Red;
}
}
}
}
}