We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Get the row at the specified index the selected row collection

Hi, 
I need something like this which you can do with  DataGridView:
object objectGrid = dataGridView1.SelectedRows[0].DataBoundItem;


I can get whole databound object from selected row. 
How I can do that with GridDataBoundGrid and GridGroupingControl?

Thank You, 

5 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team January 18, 2016 11:02 AM UTC

Hi João,

Thanks for using Syncfusion products.

GridGroupingControl:

In GridGroupingControl a particular record can be retrieved by using the Record property of the SelectedRecords.

Please refer to the following KB Link:
https://www.syncfusion.com/kb/5278/how-to-retrieve-and-modify-the-selected-record-in-the-grid

GridDataBoundGrid:

You can retrieve each record in the GridDataBoundGrid by using the GetRecordStateAtRowIndex.

Please refer the following KB Link:
https://www.syncfusion.com/kb/5953/how-to-get-the-row-data-from-griddataboundgrid

Please let us know if you have any other concern.


Regards,
Jagadeesan P.


JR João Ricardo Viccino January 18, 2016 04:30 PM UTC

thanks, but doesn't solve my problem

How I can do that with GridDataBoundGrid to get whole databound object from selected row and 
get the same data and put them in my class confrorme layot attached

because in datagridview (Microsoft Component C #) I can do like this

Nacionalidade nacionalidade = (gridNacionalidade.SelectedRows[0].DataBoundItem as nacionalidade);

 obs.: i´m sorry my english not very good

 thanks!


Attachment: example_99f56606.rar


JP Jagadeesan Pichaimuthu Syncfusion Team January 19, 2016 12:02 PM UTC

Hi João,

Sorry for the inconvenience caused.

In order to get the row object from GridDataBoundGrid as DataGridview, use the record.Table[record.Postion] and store this to the corresponding class object. Please refer to the following code. We have also created a simple sample for your reference. In the below sample, Data is a class. By using the record.Table[record.Postion] you can get the row object and store it into Data object.

C#

GridBoundRecordState record = this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(rowRangeInfo.Bottom);
Data obj2 = record.Table[record.Position] as Data;

Sample:
 http://www.syncfusion.com/downloads/support/forum/121683/ze/Sample-2134531030

Please let me know if you have any other concern.


Regards
Jagadeesan P.


JR João Ricardo Viccino January 19, 2016 04:30 PM UTC

Hi Jagadeesan P.,

Problem solved!

 I'm happy!

thank you


JP Jagadeesan Pichaimuthu Syncfusion Team January 20, 2016 11:29 AM UTC

Hi João,

We are glad to hear that your issue has been resolved. Please let us know if you need further assistance.

Regards
Jagadeesan

Loader.
Live Chat Icon For mobile
Up arrow icon