ADBlock is blocking some content on the site

ADBlock errore
Results found: 


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?


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)
        Dim ShiftID = CType(nestedItem.ParentItem, GridDataItem).GetDataKeyValue("ID")
    End Sub

If you like, leave us your opinion

Was the article helpful and is it translated correctly?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow