Question

How do i access a GridGroupHeaderItem from a GridDataItem, as in here is my code:

foreach (GridDataItem dataItem in _gridFilterQuestionAnswer.MasterTableView.GetItems(GridItemType.Item))
{
    // Code to access the GridGroupHeaderItem
}
Was it helpful?

Solution

We can not access GridGroupHeaderItem from a GridDataItem. Only reverse is possible.

Please try with the below code snippet.

foreach (GridGroupHeaderItem groupHeader in RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader))
{
    GridItem[] children = groupHeader.GetChildItems();
    foreach (GridDataItem child in children)
    {
        GridDataItem childItem = child as GridDataItem;
        //condition
    }
}

OTHER TIPS

The key is:

.GetItems(GridItemType.Item)

GridItemType supports GroupHeader, so use:

.GetItems(GridItemType.GroupHeader)

And it will be returned.

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