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
325
How to set focus to default/template add-row in UltraGrid
posted

I want to set focus to the default 'add-row' in an UltraGrid and put that row in edit mode. How can I access this row? In the documentation this row is referred to as the template add-row and allows the user to add a new row by simply typing into it.

Thanks in advance. 

Jay

 

Parents
  • 469350
    Verified Answer
    Offline posted

     Hi Jay,

          You can access the template add row via the TemplateAddRow property on the rows collection. So for the root level rows, it would go something like this:

        
                this.ultraGrid1.ActiveCell = this.ultraGrid1.Rows.TemplateAddRow.Cells[0];
                this.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode);

        Bear in mind that you cannot set focus to any control inside events that fire before the form paints, like Form_Load. So this code won't work there. If you want to do this initially when your form is first displayed, you can probably do it by uing BeginInvoke to call a method, rather than calling the code directly.

Reply Children
No Data