I have a RadGridView that has data bound to it. One of the fields is a bool field type. What I want to happen, is if the user changes that value, I want the forecolor of the entire row to change. So, in my RowFormatting, I have to code to change the forecolor, and this works, only after I move the record pointer or selected a different cell in the same row. How can I get the row to change color as soon as I change the cell's value?
TIA
Mark
6 Answers, 1 is accepted
This is because the value is changed after the cell is changed. You can set the EditMode of the checkbox column to fix this:
protected
override
void
OnLoad(EventArgs e)
{
base
.OnLoad(e);
var col = radGridView1.Columns[0]
as
GridViewCheckBoxColumn;
col.EditMode = EditMode.OnValueChange;
}
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
This was what I was exactly looking for, I just could not find it.
Thanks for the help.
I do have one other question, I was trying to do this similarly to a GridViewTextBoxColumn, but I don't see editmode property there. What are the properties I would need to update to do the same for other editor control columns to do the same as the CheckBoxColumn?
There is no such property for the other editors. The checkbox is a permanent editor that is visible at all times, the other editors are only visible when the user is editing the cell. However, you can use ValueChanged event instead of CellValueChenged. This event will be fired after the value in the editor is changed.
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
The data-bound value will be changed when the user leaves the cell and this will trigger the PropertyChanged event. There is no way to change it after each keystroke. What is the code that you are currently using to format the rows?
I have attached a small project that shows how you can use the ValueChanged event to format the row. I am using the Tag property to determine which row should be styled.
I am looking forward to your reply.
Regards,
Dimitar
Progress Telerik