I want to hook up a button that will move focus to the template add row and move the focus to the first cell to be edited so the user can type right away.
If I use
TheGrid.Rows.TemplateAddRow.Activate();
The grid scrolls to the template add row, and the column indicators are changed to indicate that the user is now editing in the new reocrd. But there is no cursor in any column. i.e. the user can't type and still has to mouse click on a column before they can actually type something.
I tried the obvious, like activating a cell, but that is the same. I tried selecting the contents of a cell, but that produced an error because its not in edit mode (or something like that).
thanks
I think I found a solution.
First I activate the the template add row, then the 1st editable cell in that row. Then I use
TheGrid..PerformAction(UltraGridAction.EnterEditMode);
That seems to work. Is that a good approach?
Am having the same issue. Could you please tell us how you did the first two steps and what event did you use..?..I have failed to find the appropriate event to perform the action.
Thanks alot
UltraGridCell Cel = GetFirstEditableCell(Row);
if (Cel != null)
{
Cel.Activate();
PerformAction(UltraGridAction.EnterEditMode);
}
I am using Infragistics v10.1.20101.2071 and having trouble with EnterEditMode. The cell will not enter edit mode unless I explicitly click on it.
I have a form with:
There is one datatable in the dataset and that table has six columns.
For the grid:
The steps that I perform:
The code is activating the TemplateAddRow and selecting the correct cell, but it will not EnterEditMode and I cannot figure out why.
Any help would be greatly appreciated.
Hi,
This code will never work in Form_Load because the DotNet Framework does not allow you to set focus to any control inside this event.
If you want to activate a cell in the TemplateAddRow when your form is initially displayed, you will have to use some other event, or use BgeinInvoke to call a method from the Form_Load instead of trying to do it directly inside the event.
AfterCellUpdate should work okay, I think. If that's not working then it might be a timing issue of some kind. I'd have to see the code to test it for sure.
Sorry about that.
There were two locations that I tried calling the code from: (VB.net, .NET v3.5, VS2008)
You don't say where you are calling this code from, but my guess is that your grid control doesn't have focus.
Try calling grid.Focus() first.