This is a migrated thread and some comments may be shown as answers.

how to access "Click here to add new row"

2 Answers 144 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Emilio
Top achievements
Rank 1
Emilio asked on 04 May 2012, 08:39 AM
Hi,

Is there a way to access the "Click here to add new row" in runtime? i want to add a command button for a new record. in the click event, I want to set focus the in the "Click here to add new row" as if the user  clicked it manually.?


Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 04 May 2012, 10:39 AM
Hi Emilio,

You can access the new row by getting the TableAddNewRow object from the MasterView of RadGridView:

this.radGridView1.MasterView.TableAddNewRow;

In order to achieve your scenario, you should first make the new row current by setting the CurrentRow of RadGridView to the new row object. Then, most probably, you would want to put RadGridView in edit mode, so the complete code snippet for your case is:
private void radButton1_Click(object sender, EventArgs e)
{
    this.radGridView1.CurrentRow = this.radGridView1.MasterView.TableAddNewRow;
    this.radGridView1.BeginEdit();
}

I hope this helps. Let me know if you have additional questions. Regards,
Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Emilio
Top achievements
Rank 1
answered on 04 May 2012, 02:20 PM
Thank you very much
Tags
GridView
Asked by
Emilio
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Emilio
Top achievements
Rank 1
Share this question
or