Hi
I have a RadGridView populated from a DataSet that has one MasterTemplate and two child templates which is working fine.
The rows from the two child templates are displayed in a RadPageView element in tabs - which has different modes to display I have learnt.
But I want to have all the rows from both child templates displayed one under the other - without having to click through the categories and without headers.
Is that possible?
1 Answer, 1 is accepted
Hello, Julian,
Following the provided information, I suppose you have two child templates that contain different data and columns. Can you confirm this?
Yes, rows from the two child templates are displayed in tabs represented by RadPageView and may have different modes to display, eg. Strip, Stack, Outlook, ExplorerBar. We have a KB article that shows how to display all rows from both child templates, one under the other,r without using tabs. You can achieve this by customizing the hierarchy view of the RadGridView. Please refer to How to Change PageViewMode for the Nested Levels in RadGridView
As to hiding the child templates' headers, see the following example: Hiding Child Tabs when no Data is Available.
This approach should help you display all rows from the child templates in a stacked manner without headers. If you need further assistance or customization, please let me know.
Regards,
Nadya | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Yes, I have two child templates with different data, by chance they have identical colmuns
Thank you for your two examples, it is indeed what I was looking for.
I assume that you advise me to use the ExplorerBar PageViewMode, and actually I wasn't aware that it is what I was aiming at.
But unfortunately the second example you provided does only work for the standard PageViewMode. With the ExplorerBar PageVieMode the rows of all but one of the tabs get deleted.
I think it would be good to know how to hide the headers of the tabs of the PageView without hiding the rows.
In ExplorerBar PageViewMode I would then have what I want: all rows without any headers
Hello, Julian,
I am glad that the provided examples were useful for you to achieve your grid setup.
Yes, you can hide the headers of the tabs for the RadPageView when using the ExplorerBar mode. To do so, you need to handle the ViewCellFormatting and access the RadPageViewExplorerBarElement.
Please refer to the following code snippet:
private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
GridDetailViewCellElement cellElement = e.CellElement as GridDetailViewCellElement;
if (cellElement != null)
{
RadPageViewExplorerBarElement explorerBarElement = cellElement.PageViewElement as RadPageViewExplorerBarElement;
if (explorerBarElement != null)
{
explorerBarElement.Header.Visibility = ElementVisibility.Collapsed;
}
}
}
I hope this helps. If you have other questions, do not hesitate to contact me.
Regards,
Nadya
Hello, Julian,
Here is how you can hide the headers of each tab/page. In my opinion, in such a case when no title is presented for the separate page, it may get confusing to the clients what exactly is presented in the grid. However, I am not familiar with your exact design but if this is what you are trying to achieve, please use the following code snippet:
private void RadGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
GridDetailViewCellElement cellElement = e.CellElement as GridDetailViewCellElement;
if (cellElement != null)
{
RadPageViewExplorerBarElement explorerBarElement = cellElement.PageViewElement as RadPageViewExplorerBarElement;
if (explorerBarElement != null)
{
explorerBarElement.Header.Visibility = ElementVisibility.Collapsed;
foreach (RadPageViewExplorerBarItem item in explorerBarElement.Items)
{
if (item != null)
{
item.Visibility = ElementVisibility.Hidden;
}
}
}
}
}
Regards,
Nadya
Thank you. It is what I want to achieve because the clients want exactly that, no need for headers
But another but:
With ElementVisibility.Hidden there is still a vast white space instead of the headers. With ElementVisibility.Collapsed the rows are gone as well.
Hello, Julian,
Thank you for clarifying this. To avoid the vast white space reserved for the headers, then you can set the Text property to an empty string as follows (instead of setting ElementVisibility.Hidden):
if (item != null)
{
item.Text = "";
}
Okay, technically you could argue that it solves the issue.
But it looks horrible and therefore wont be a solution that is usable,
The headers are still there only smaller
Hello, Julian,
With my latest code snippet, I am not able to observe tab headers on my end. Here is the result on my side:
Maybe there is something different on your side. What comes to my mind is to set RadPageViewExplorerBarItem.DrawText = false; This property will prevent the text from drawing in the item.
//ViewCellFormatting
//...
foreach (RadPageViewExplorerBarItem item in explorerBarElement.Items)
{
if (item != null)
{
item.DrawText = false;
}
}
Can you set the DrawText property and let me know if it remove the headers completely on your side?
Hello, Julian,
Is it possible to open a ticket and provide your project there? I need to investigate why the headers are still there, but without having your exact setup, it would be difficult to determine. When I have the project that shows the problem, I will be able to inspect it more precisely and assist you further.
Regards,
Nadya