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
25
Unable to Set focus on UltraGrid within the UltraTab
posted

Dear Infragistics Team,

I am having a UltraTab instance with a UltraGrid instance within it. The focus has been set on the UltraTab using Tab.Selected command.

However our requirement is to have the focus set on a particular control (an UltraGrid) within the UltraTab. Please confirm if you can provide a code snippet that helps us to access the various controls within a UltraTab as well as set the focus on a particular Control (an UltraGrid).

Regards,

Dhiraj.

  • 2575
    Verified Answer
    Offline posted

    Hello Dhiraj,

    It is possible to set focus to the UltraGrid, or any other control you have in the UltraTabControl, through a few ways. Below I've pasted a code snippet I used to write a button which switches to the tab and sets focus to the control within, using a few different methods, the last one focusing on a specific cell in the grid:

            private void ultraButton1_Click(object sender, EventArgs e)
            {
                //set to the second tab
                ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[1];

                //set focus to the grid, if you have a reference to that grid
                ultraGrid1.Focus();
                
                //set focus to the first control in the TabPage's controls collection
                ultraTabControl1.Tabs[3].TabPage.Controls[0].Focus();

                //set focus to specific cell
                ultraGrid1.ActiveCell = ultraGrid1.Rows[3].Cells[2];
            }

    Please let me know if I can provide any further assistance.