This is a migrated thread and some comments may be shown as answers.

add line separator to grid based on checked rows

1 Answer 226 Views
PageView
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 04 Jul 2013, 04:48 PM
I have a grid with a check box in it as the first column.  when users check stuff, i resort the grid to move all checked rows to the top of the grid to group them together.  Is it possible to add a line separator between the checked and unchecked rows?  see the attached screen shot and this will make more sense.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 08 Jul 2013, 08:41 AM
Hello John,

Thank you for writing.

To achieve the desired functionality, I would suggest that you use the CellFormatting event of the control, where you can compare the value of the check box cell for the current and the next row and if it differs, you can change the appearance of the bottom border to the cells in that row. Here is an example:
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    int index = radGridView1.ChildRows.IndexOf(e.Row);
    index++;
 
    GridViewRowInfo nextRow = null;
    if (radGridView1.ChildRows.Count > index)
    {
        nextRow = radGridView1.ChildRows[index];
    }
 
    if (nextRow != null && !object.Equals(e.Row.Cells["BoolColumn"].Value, nextRow.Cells["BoolColumn"].Value))
    {
        e.CellElement.BorderBottomColor = Color.Red;
        e.CellElement.BorderBottomWidth = 5;
    }
    else
    {
        e.CellElement.ResetValue(LightVisualElement.BorderBottomColorProperty, ValueResetFlags.Local);
        e.CellElement.ResetValue(LightVisualElement.BorderBottomWidthProperty, ValueResetFlags.Local);
    }
}

I hope that you find this information useful.

Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
PageView
Asked by
John
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or