I have a hierarchical grid that looks like this:
However, I need it to look like this:
I need the two tabs with the caption table to follow one another on the 3rd level rather than exist side-by-side. How do I accomplish this?
Thanks
Carl
2 Answers, 1 is accepted
Hello Carl,
You can achieve similar visualization by using the grouping or hierarchy feature of RadGridView. This will allow you to create a hierarchy of items with the Payments and Returns values at the bottom.
Regards,
Martin Ivanov
Progress Telerik
Martin
I finally got back to this and found this article which got me to where I need to be:
https://www.telerik.com/products/winforms/documentation/knowledge-base/pageview-mode-in-nested-gridview-levels
The problem now is the headers are not looking right.
When collapsed they look like this:
When I expand it looks like this:
I don't need the first Returns header. I need the first grid to be captioned as Payments and the second as Returns, preferably with a gray bar to offset it from the data.
My code is attached. What am I missing here?
Thanks
Carl
Thank you for the extra information. I've used it to setup a sample project, but couldn't reproduce the exact visualization. However, the first Returns is probably the page view header. You can hide this by overriding the CreatePageViewElement method of the custom CustomGridDetailViewCellElement class.
protected override RadPageViewElement CreatePageViewElement(IRadPageViewProvider pageViewProvider)
{
RadPageViewElement pageViewElement = base.CreatePageViewElement(pageViewProvider);
// Hide the dynamic header that shows the selected tab name
if (pageViewElement is RadPageViewExplorerBarElement explorerBarElement)
{
// Hide the header completely
explorerBarElement.Header.Visibility = ElementVisibility.Collapsed;
// Alternative: Modify the header text instead of hiding
// explorerBarElement.Header.Text = "Your Custom Header Text";
}
return pageViewElement;
}I've attached my test project to show this suggestion. Can you give it a try and let me know how it goes?
If this doesn't help, feel free to modify the project to recreate the troublesome behavior and send it over.
Martin
Thanks for this. The demo was very helpful and the override took care of one part of the issue. My question now is how to get rid of the entire row that says HIDE ME in the UI below. This didn't do it:
ShowChildViewCaptions = false;
Hi, Carl,
To hide the caption ("HIDE ME") for each hierarchical template when using the ExplorerBar mode for the grid hierarchy, you need to subscribe to the ViewCellFormatting event before the grid is populated with data and manipulate the size of each RadPageViewExplorerBarItem. A sample code snippet is demonstrated below, and the result is illustrated as well:
this.gvDrawerSummary.ViewCellFormatting += (sender, e) =>
{
GridDetailViewCellElement detailCell = e.CellElement as GridDetailViewCellElement;
if (detailCell != null && detailCell.PageViewElement!=null)
{
for (int i = 0; i < detailCell.PageViewElement.Items.Count; i++)
{
detailCell.PageViewElement.Items[i].Visibility = Telerik.WinControls.ElementVisibility.Hidden;
detailCell.PageViewElement.Items[i].MaxSize= new Size(1, 1);
}
}
};Before:
After:
I believe that this would fit the scenario you need to cover.
Thanks for this. I tried Martin Ivanov's approach last week and it worked perfectly!
Carl
