Hi,
We have an application that's been in production for over a year. Basically, it manages open tickets.
Apparently this is the first time we've had more than 20 open tickets where tickets appearing on the 2nd page had child tickets.
The problem is that - when the page is changed the Self Hierarchy breaks down and the grid does not recognize a ticket as a parent ticket, and therefore it's child tickets are unavailable.
I use a recursive function that is passed a GridTableView that grabs an array of nestedVieItems and determines whether they have any children, and if so it will add the button to allow them to be visible and it changes the styling.
basically the problem is that the MasterTableView does not contain nestedviewitems for items that aren't on the first page.
If I set the PageSize = aNumber > numberOfTickets, then everything works as expected, its when the pagesize is set to a number less than the number of tickets and a ticket on the second page has children, that we have an issue.
Oh - and if I change the code to have the expand/collapse button always visible, when I click it next to an item on the 2nd page that I know has children - it says: "No child records to display". So I guess the issue isn't with either of the 2 below subroutines, its that the RadGrid doesn't think that any of my items on a Page that is not the first page has any children.
Below is the code i use to hide/show the ExpandCollapse button and set the style of the row.
We have an application that's been in production for over a year. Basically, it manages open tickets.
Apparently this is the first time we've had more than 20 open tickets where tickets appearing on the 2nd page had child tickets.
The problem is that - when the page is changed the Self Hierarchy breaks down and the grid does not recognize a ticket as a parent ticket, and therefore it's child tickets are unavailable.
I use a recursive function that is passed a GridTableView that grabs an array of nestedVieItems and determines whether they have any children, and if so it will add the button to allow them to be visible and it changes the styling.
basically the problem is that the MasterTableView does not contain nestedviewitems for items that aren't on the first page.
If I set the PageSize = aNumber > numberOfTickets, then everything works as expected, its when the pagesize is set to a number less than the number of tickets and a ticket on the second page has children, that we have an issue.
Oh - and if I change the code to have the expand/collapse button always visible, when I click it next to an item on the 2nd page that I know has children - it says: "No child records to display". So I guess the issue isn't with either of the 2 below subroutines, its that the RadGrid doesn't think that any of my items on a Page that is not the first page has any children.
Below is the code i use to hide/show the ExpandCollapse button and set the style of the row.
public void Page_PreRenderComplete(object sender, EventArgs e)
{
if(btnToggleHierarchy.Checked)
HideExpandColumnRecursive(RadGrid1.MasterTableView);
}
/// <
summary
>
/// Create buttons on items that have children
/// </
summary
>
/// <
param
name
=
"tableView"
></
param
>
public void HideExpandColumnRecursive(GridTableView tableView)
{
GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView);
foreach (GridNestedViewItem nestedViewItem in nestedViewItems)
{
foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)
{
nestedView.Style["border"] = "0";
Button MyExpandCollapseButton = (Button)nestedView.ParentItem.FindControl("MyExpandCollapseButton");
if (nestedView.Items.Count == 0)
{
if (MyExpandCollapseButton != null)
{
MyExpandCollapseButton.Style["visibility"] = "hidden";
((TableCell)MyExpandCollapseButton.Parent).BackColor = System.Drawing.Color.White;
}
nestedViewItem.Visible = false;
}
else
{
if (MyExpandCollapseButton != null)
{
//Only set the background if we are the Highest Parent... otherwise leave it to the
//alternating styles
if (nestedView.ParentItem.OwnerTableView == RadGrid1.MasterTableView)
((TableCell)MyExpandCollapseButton.Parent).CssClass = "ExpandCollapseBackground" ;
MyExpandCollapseButton.Style.Remove("visibility");
}
}
if (nestedView.HasDetailTables)
{
HideExpandColumnRecursive(nestedView);
}
}
}
}