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
1467
Usability Issue: ColumnStyle.DropDownList in Editable Grids
posted

In our application, we have a number of editable UltraWinGrids with columns that have ColumnStyle.DropDownList. Our users have encountered a usability issue because of the following:

Suppose you click a cell in a column of this type, and then, to navigate away, you press the up or down-arrow keys or you move the mouse scroll wheel. Without realizing it, you have put the row containing the cell into edit mode *and* changed the selection in the drop-down list. Then, if you click outside the row, the change gets committed back to the database.

Without realizing it, you have corrupted your data.

Is there a way to get around this without abandoning drop-down lists and Excel-style in-place editing? For example, can we modify the behavior of editable drop-down lists so you can't change the selection unless you first drop down the list by clicking its down-arrow button?

Parents
No Data
Reply
  • 37774
    posted

    The best approach that I can think of is to handle the KeyDown of the grid and handle the event if you don't want this behavior to happen.  The following code worked for me with a ValueList assigned to the column with a Style of DropDownList:

     private void ultraGrid1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode != Keys.Up && e.KeyCode != Keys.Down)
            return;

        UltraGridCell activeCell = this.ultraGrid1.ActiveCell;
        if (activeCell != null && activeCell.Column.Key == "Col 2" && activeCell.ValueListResolved.IsDroppedDown == false)
            e.Handled = true;
    }

    As for the MouseWheel,  I'm not really sure that there's a way to cancel this one, but I'd think the Up/Down keys are the ones that would give you more problems for navigating across the rows.

    -Matt

Children
No Data