Focus on first cell of radGridView on form load

1 Answer 24 Views
DataEntry Form GridView
Roberto
Top achievements
Rank 1
Roberto asked on 07 Jan 2024, 03:48 AM

Good evening, community,

After trying on my own and not being able to find a solution, I am in need of help.

Problem:

I have a radGridView control in a form called radGridView1. I have added columns to it, but I want the focus() and cursor to blink in the first cell of the first column when the form loads. This would allow me to start typing directly in the cell. I have tried everything I can think of, but I have not been able to achieve this.

What I have tried:

The closest I have come is with the following code:

I have commented out all of the code to show you what I have been doing, but I have not been able to get it to work. Please help me find a solution to my problem.

Thank you,

Community

1 Answer, 1 is accepted

Sort by
1
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 08 Jan 2024, 03:56 PM

Hello, Roberto,

To achieve this behavior, you can use the BeginEdit method. This method enters a specified cell into edit mode and you would be allowed to start typing directly when the form loads. I would recommend you override form's Shown method and call the BeginEdit method there. Thus, you will ensure that the editor is activated after the form is initialized and the grid is populated with data. 

protected override void OnShown(EventArgs e)
{
    base.OnShown(e);
    this.radGridView1.MasterView.Rows[0].Cells["Relation"].BeginEdit();
}

I hope this helps. Should you have any other questions do not hesitate to contact me.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DataEntry Form GridView
Asked by
Roberto
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or