lundi 30 mars 2015

Change color of edited text to red

I have gridview with five columns. i have loaded the data on it. the user can edit the text within the column cell. if the user edited the text,those edited text must be red. Only edited


e.g


stackoverflow = StackOverFlow (you will not that i have change/edited to caps. those edited caps must change color. in this case S O and F will change color to red)


this is what i have tried but not working the way



private void Gridview_CellBeginEdit_1(object sender, DataGridViewCellCancelEventArgs e)
{
DataGridViewCell cell = Gridview_Output[e.ColumnIndex, e.RowIndex];
if (cell.Tag != null && cell.Tag.ToString() != cell.Value.ToString())
cell.Style.ForeColor = Color.Red;
else
DataGridViewCell cell = Gridview_Output[e.ColumnIndex, e.RowIndex];
cell.Tag = cell.Value != null ? cell.Value : "";

}

Aucun commentaire:

Enregistrer un commentaire