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
225
Problem with EnterEditMode
posted

 

I try to insert a new row in a grid and then set a cell automatically to edit mode.  The row is inserted via databinding to a business object, and not directly to the grid.  The row is highlighted but no cell is in edit mode. If I first click on the grid and then inserts a new row it works for every new row thereafter. It's look like I am missing something the mouseclick do.  A row insert is done by adding a new business object, and I deal with the new row in InitializeRow like this:

 private void csfGridIkkeBehandletNemd_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)

{

UltraGrid grid = (UltraGrid)sender;

e.Row.Activate();

UltraGridCell aCell = e.Row.Cells["Tekst"];

grid.ActiveCell = aCell;

grid.PerformAction(
UltraGridAction.EnterEditMode, false, false);

 

}

 The PerformAction seems to have no effect. If I click the grid first, it works as expected.

Some suggestion?

Kind Regards

Magnus

Oslo, Norway 

 

Parents
No Data
Reply
  • 3707
    posted

    Here's what I use for doing what you ask:

    private void csfGridIkkeBehandletNemd_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) 
    { 
    	UltraGrid grid = (UltraGrid)sender; 
    	e.Row.Activate();
    	UltraGridCell aCell = e.Row.Cells["Tekst"]; 
    	grid.ActiveCell = aCell;
    	grid.PerformAction(UltraGridAction.EnterEditMode, false, false); 
    	grid.ActiveCell.SelStart = 0;
    }
Children