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

Retrieving row in GDBG

Hi, I have a GDBG and the DataSource of this grid is bounded to an ArrayList of objects. Is there a way that I can get the corresponding object(s) that the user selected from the grid?

Thanks.

2 Replies

AD Administrator Syncfusion Team August 31, 2006 10:40 AM UTC

Hi Kai,

Try this code to get the selected object from the grid. Please refer the attached sample for more details.

CurrencyManager cm = this.BindingContext[this.gridDataBoundGrid1.DataSource] as CurrencyManager;
ArrayList arr = cm.List as ArrayList;
Console.WriteLine("For Current Item >>>>>>>" + cm.Current);

Console.WriteLine("For Selected Item >>>>>>>" );
foreach( GridRangeInfo info in this.gridDataBoundGrid1.Selections.GetSelectedRows(false,true))
for(int i = info.Top ;i < info.Bottom;i++)
Console.WriteLine("Item >>>>>>>" + arr[i]);

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/GArrayList_56ef0749.zip

Let me know if this helps.
Best Regards,
Haneef


AD Administrator Syncfusion Team September 1, 2006 02:01 AM UTC


It works as expected. Thanks.
>Hi Kai,

Try this code to get the selected object from the grid. Please refer the attached sample for more details.

CurrencyManager cm = this.BindingContext[this.gridDataBoundGrid1.DataSource] as CurrencyManager;
ArrayList arr = cm.List as ArrayList;
Console.WriteLine("For Current Item >>>>>>>" + cm.Current);

Console.WriteLine("For Selected Item >>>>>>>" );
foreach( GridRangeInfo info in this.gridDataBoundGrid1.Selections.GetSelectedRows(false,true))
for(int i = info.Top ;i < info.Bottom;i++)
Console.WriteLine("Item >>>>>>>" + arr[i]);

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/GArrayList_56ef0749.zip

Let me know if this helps.
Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon