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

SelectionChanged event and Fields

3 Answers 227 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 20 Feb 2009, 01:50 AM
Hi,

maybe i'm blind but i don't find a solution, how to get the value of a certain column after selecting a row.

Documentation of the RadGridView for WPF (SelectionChanged event) :

 

Private Sub radGridViewSelection_SelectionChanged(ByVal sender As ObjectByVal e As Telerik.Windows.Data.SelectionChangeEventArgs)  
        label1.Content = radGridViewSelection.SelectedRecord.Fields("CustomerID").ToString  
End Sub 

I tried to use it as described, but "Fields" isn't a Member of "Telerik.Windows.Data.Record"!?

Thanks for help
Martin

Edit: In another Thread i found, that "CurrentRecord.Fields" doesn't exist anymore in the current release (the documentation is not very helpful). But i still do not understand, how to get the value in a specific column of the selected row.

3 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 23 Feb 2009, 04:05 PM
Hi Martin,

You can cast the SelectedRecord.Data to your underlying data item and then figure out what property (column) you need to access. For example if you are binding to a data table your data items are data rows so you can do the following:
DataRecord selectedDataRecord = (DataRecord)myGridView.SelectedRecord;  
DataRow selectedRow = (DataRow)selectedDataRecord.Data;  
object columnValue = selectedRow["columnName"]; 


Sincerely yours,
Milan
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.
0
Rikin Patel
Top achievements
Rank 1
answered on 14 Feb 2010, 04:10 AM
thank you very much ...................

but it shows  Warning...
like.,....
'Telerik.Windows.Data.DataRecord' is obsolete: 'This class is obsolete and is not used anymore.' 

pls reply me............
0
Vlad
Telerik team
answered on 15 Feb 2010, 07:13 AM
Hello,

These classes were obsolete for Q2 2009 and deleted in Q3 2009. Please use Items/SelectedItems instead.

Sincerely yours,
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.
Tags
GridView
Asked by
Martin
Top achievements
Rank 1
Answers by
Milan
Telerik team
Rikin Patel
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or