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

Retrieve data in code behind from wpf radGrid binded with Multiple collections

0 Answers 51 Views
GridView
This is a migrated thread and some comments may be shown as answers.
CQT
Top achievements
Rank 1
CQT asked on 17 Dec 2012, 01:50 PM
Hello!
In my application I'm trying to get data from a RadGridView in my code behind. Everything is ok if I bind the grid directly from entity data model with just a table, because this code works fine:

Example:

Dim idordine As String = DirectCast(testGrid.SelectedItem, Orders).OrderID


In my application I binded my grid with a linq query and my testgrid(radgrid) correctly shows results.
This is a linq query like the one in my project, used to bind my radgrid:

Dim query = From employee In employees Join order In orders On employee.EmployeeID = order.EmployeeID
Select New With { _
    .EmployeeName = employee.LastName, _
    .OrderName = order.ShipName, _
    .OrderDate = order.OrderDate _
}
testGrid.ItemsSource = query
 
 
        Me.Griglia.ItemsSource = qry


My problem raises in code behind when I try to retrieve data of the selected row of my testgrid after a double-click event.
Using the first method I have to assign a type for the directcast, but in case of binding with the query I have no idea of what kind of object to put instead of Orders type.

Any suggestion?

BestRegards



No answers yet. Maybe you can help?

Tags
GridView
Asked by
CQT
Top achievements
Rank 1
Share this question
or