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

Forced to select checkbox rows creating unacceptable interface

1 Answer 16 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 2
George asked on 17 Jan 2017, 06:01 PM

I have a  with GridClientSelectColumn (checkbox) column.  It seems I cannot set the checkboxes from the data using a DataTable.  So I am forced to set the checkboxes in my in a second data pass.   The grid is being used to select rows, the checks are the data, the user has picked rows and is trying to update them in this application scenario.

protected void MemberGrid_PreRender(object sender, EventArgs e)
{
    // For Checking CheckBox Column for time first time on Pageload
    if (!IsPostBack && mode == Team.Modes.Edit) {
        foreach (GridDataItem item in MemberGrid.MasterTableView.Items) {
            string memberStr = item[TeamData.MEMBER_ID].Text;
            if (team.HasMember(int.Parse(memberStr))) {
                CheckBox cb = (CheckBox)item[TeamData.TEAM_SELECT].Controls[0];
                cb.Checked = true;
                item.Selected = true;
            }
        }
    }
}

 

This works, but the problem is I must select the row (statement: item.Selected = true;). Only setting the Checked to true will not check the checkbox - I consider this a bug.  Forcing the Selected state means that if you click on the grid, the selection is removed along with every check. I consider this an unacceptable interface for my users.  Losing all your checked boxes so simply is bad. Additionally, checking a box does not remove the select from the rows - in fact, I cannot figure out a way to unselect without removing all the checks.  All this has forced me to put this note on my web page above the grid.

Important tip, hold the Ctrl key down while selecting rows to avoid unselecting other rows.

I do not know how this will impact tablet users that do not have a Ctrl key.  I suspect editing your checked rows will not be possible. Changing a filter or sorting by column removes the selection along with all the checks (that is, it remove the user's data).

This forum post discusses checking boxes and stops at needing to select the row after the check only does not work. 

George

1 Answer, 1 is accepted

Sort by
0
George
Top achievements
Rank 2
answered on 17 Jan 2017, 06:15 PM

Discovered a property the fixes the problem.  

adminGrid.ClientSettings.Selecting.UseClientSelectColumnOnly = true;

This forces the user to click the checkbox, which is acceptable considering the alternative.

 

Tags
Grid
Asked by
George
Top achievements
Rank 2
Answers by
George
Top achievements
Rank 2
Share this question
or