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

Get Underlying Object

2 Answers 81 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 12 Mar 2009, 10:05 PM
I bind my radGridView to a custom object - let's say a CustomerList that is made up of a bunch of Customer objects.

How do I get the underlying Customer object from the CurrentRow (or ANY row, for that matter)?

Thanks.

-- Greg

2 Answers, 1 is accepted

Sort by
0
Krtek
Top achievements
Rank 1
answered on 13 Mar 2009, 07:32 AM
You can to this by this code

if (IsGridDataRowSelected(radGridView)) 
     Customer someVariable = (Customer)radGridView.CurrentRow.DataBoundItem; 
 
... 
 
private bool IsGridDataRowSelected(RadGridView radGridView) 
     return radGridView.Rows.Count > 0 && radGridView.CurrentRow != null && (radGridView.CurrentRow.GetType() == typeof(Telerik.WinControls.UI.GridViewDataRowInfo)); 

0
Jack
Telerik team
answered on 13 Mar 2009, 01:37 PM
Hi Krtek, you are correct. Thank you for your suggestion.

Greg, if you have more questions don't hesitate to ask.

Kind regards,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Greg
Top achievements
Rank 1
Answers by
Krtek
Top achievements
Rank 1
Jack
Telerik team
Share this question
or