Question

I have a RadGrid and inside the RadGrid1.MasterTableView.NestedViewTemplate I have another RadGrid. The outer RadGrid is RadGrid1, the inner RadGrid is RadGrid2. Both the RadGrids were created from code behind. I've defined a relation, like this:

RadGrid1.MasterTableView.NestedViewSettings.ParentTableRelation.Add(New Telerik.Web.UI.GridRelationFields() With {.DetailKeyField = "ID", .MasterKeyField = "ID"})

My question is:

I have a NeedDatasource event for the inner RadGrid and I would like to filter by the ID of the parent row's ID. How can I do that?

Était-ce utile?

La solution

Problem solved. I've added a handler for the RadGrid2.NeedDatasource with the following delegate:

    Public Sub RadGrid2_NeedDatasource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs)
        Dim innerGrid As RadGrid = CType(source, RadGrid)
        Dim nestedItem As GridNestedViewItem = CType(innerGrid.NamingContainer, GridNestedViewItem)
(nesteditem.ParentItem)).GetDataKeyValue("ID")); 
        Dim ShiftID = CType(nestedItem.ParentItem, GridDataItem).GetDataKeyValue("ID")
        '...
    End Sub
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top