After the check box is added to the GridControl, the solution to read the value only after the check box loses focus

Today, in response to the needs of the site, it is necessary to add a multi-selection function on a certain interface, as follows.

My solution is:

① First, add a column of multi-selection boxes on the GridControl control for users to choose.

② Then write your own specific logic code in the CellValueChanged event of GridView. As shown below.

 However, during the test, I found a problem here, that is, no matter how I click the check box, the CellValueChanged event is not triggered. Occasionally, when I click elsewhere, I find that this event is actually triggered, so I locate the problem. The problem is probably: when we click the check box, the cell is in the editing state, and its value has not been updated to the gridControl at this time .

Therefore, I thought that I need to submit the data manually, and the effect has been achieved, so there is the third step below.

③ Manually submit the data in the CellValueChanging event of GridView. As shown below

At this point, we have solved this problem, and we can successfully trigger the CellValueChanged event and get the value of the check box in it.

Guess you like

Origin blog.csdn.net/weixin_45963929/article/details/128577593