Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
Checkbox not checking when selecting in a grid
posted

I have a grid with read only columns and one checkbox column.

I set the grids CellClickAction: grid.DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect

because I have a click event handler on the grid to process the selected row.

The issue is when I check the checkbox, the check never makes it through.

My workaround is as follows:

private void grid_MouseClick(object         sender,
                                            MouseEventArgs e)
        {
            var ug = (UltraGrid)sender;
            if (ug.ActiveCell != null && ug.ActiveCell.Column.Key.Equals("Check"))
            {
                ug.ActiveRow.Selected = true;
                ((CheckEditor) ug.ActiveCell.EditorResolved).CheckState = CheckState.Checked;
            }
            var selectedRows = grid.Selected;

            if (selectedRows == null ||
                selectedRows.Rows.Count == 0) return;

            Service.RowClicked(selectedRows.Rows[0]
                                                                                .ListObject as
                                                                        IViewModel);

But as soon as you "select" the ActiveRow it clears the check box again.