I have a GridView where I am changing the cell BackColor when the value is changed:
void
TelerikGridView_CellValueChanged(
object
sender, GridViewCellEventArgs e)
{
if
(e.Row.Tag ==
null
)
e.Row.Tag = e.Column.Name;
if
(!e.Row.Tag.ToString().Contains(e.Column.Name))
e.Row.Tag += e.Column.Name;
}
void
TelerikGridView_CellFormatting(
object
sender, CellFormattingEventArgs e)
{
if
(e.Row.Tag !=
null
&& e.Row.Tag.ToString().Contains(e.Column.Name))
{
e.CellElement.DrawFill =
true
;
e.CellElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
e.CellElement.BackColor = Color.Red;
}
else
{
e.CellElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local);
e.CellElement.ResetValue(LightVisualElement.DrawFillProperty, Telerik.WinControls.ValueResetFlags.Local);
}
}
This is working as expected, now I want to add a "Reset" button, when I click on it I would like to reset or remove the format of all the cells that have been changed, how can I accomplish this?
Regards,
Alberto