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

How do you get a value from a selected row

3 Answers 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jerry Kurata
Top achievements
Rank 1
Jerry Kurata asked on 03 Aug 2010, 06:54 AM
Hi,

I need to get the value displayed in a cell of a row.  I need to do this for both selected and unselected rows.  Does someone have a code sample.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 03 Aug 2010, 06:59 AM
Hi,

 If you cast SelectedItem property to your type you can get any property. 

Kind regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Igor Z
Top achievements
Rank 1
answered on 08 Aug 2010, 12:53 PM
Hi,

Could you please give us a code sample ?

Let's say for example we want the value of the "Client" cell in the selected row.

Thanks
0
Vanya Pavlova
Telerik team
answered on 10 Aug 2010, 07:12 AM
Hi Igor Z,

Suppose that we have an InformationClass which holds information about different clients,and it has a property Client,which represents the ClientId of the current client.
You can retrieve the value of the Client property in the selected row with this code:

var client = (this.radGridView.SelectedItem as InformationClass).Client.ToString();

 

All the best,
Vanya Pavlova
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Jerry Kurata
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Igor Z
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or