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
45
Activating a cell and putting it edit mode
posted

I'm evaluating your software library and I'm using a BindingNavigator in conjuction with UltraGrid.  At runtime, when the BindingNavigator's "Add" button is clicked a row is added and the grid moves to the new row.  All of this is fine, but what I also what to happen is, I want to set the cell to edit via its fieldname, and automattically put the cell in edit mode.  With my current tools, I do this:

        private void navAddNew_Click(object sender, EventArgs e)
        {
            //By default, a new row is added.  Any default data can be initialized
            //here.
            dbGrid.Columns["CustomerID"].Value = "";

            //Remove focus from the Filterbar.  Otherwise, the following column
            //assignement will focus the column in the Filterbar not the grid.
            dbGrid.FilterActive = false;

            //Focus the column to start editing and activate the editor
            dbGrid.Col = 0; //yes, it's an index, but I want to use the fieldname
            dbGrid.EditActive = true;

            //Disable the Add-Button

            navAddNew.Enabled = false;
        }
 

However, I am having problems identifying the appropriate properties and methods in UltraGrid to accomplish this simple task.  I've tried a few different things, none of which work, some of which throw null reference exceptions.

  • 469350
    Offline posted

     You could try something like this:

            private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
            {
                this.ultraGrid1.Rows[this.ultraGrid1.Rows.Count - 1].Cells["My Coluimn"].Activate();
                this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);           
            }