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
530
AllowAddNew behavior
posted

I've been playing around with the AllowAddNew enumerations and can't quite find one that works like I want.  I simply want a template row that the user can type into.  After tabbing off of the last column, I want the row to be added to the grid and the cursor to be sitting in the first column of the template row, waiting for more input. 

The TemplateOnTopWithTabRepeat comes close, but when I type my first character into the template row it creates a blank row in the grid and the data entry happens there.  Why can't the data entry just happen in the template row itself without creating this second row?  Is there a property that would influence this behavior?

Parents
No Data
Reply
  • 30
    Offline posted

    I found a workaround that may help:

    If you use FixedAddRowOnTop instead of TemplateOnTopWithTabRepeat, you can create the behavior you want by checking for the Tab key on the last column of your grid.  Here's an example:

    private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e)

    {

    if ( e.KeyChar == (char)Keys.Tab

    && this.ultraGrid1.ActiveCell == this.ultraGrid1.ActiveCell.Row.Cells["LastColumnKeyHere"]

    && this.ultraGrid1.ActiveCell.Row.IsAddRow == true )

    {

    this.ultraGrid1.ActiveCell.Band.AddNew();

    }

    }

     This seems to work for me and hope it helps you.

     Chris

Children
No Data