HI all
I'm following the example available here
http://www.telerik.com/help/aspnet-ajax/grdhideexpandcollapseimageswhennorecords.html
The problem is that when i test on my page it doesnt quite work in the way i am expecting
My grid is initially filtered by a dropdown combo box (RadCombo actually ) therefore a postback is required.
When i change options in the drop down the grid is shown with all expand images showing
If i select any expand images the grid refreshes but this time hides all the expand images apart from the ones which actually have detail records.
How can i modify this so that when the grid is refreshed based on a selection from the combo box , i get the response i 'm having (i.e hiding the expand buttons when no detail records are available)
Thanks again folks
so my code is the following
and the main settings for the grid are
Thanks guys/Gals
I'm following the example available here
http://www.telerik.com/help/aspnet-ajax/grdhideexpandcollapseimageswhennorecords.html
The problem is that when i test on my page it doesnt quite work in the way i am expecting
My grid is initially filtered by a dropdown combo box (RadCombo actually ) therefore a postback is required.
When i change options in the drop down the grid is shown with all expand images showing
If i select any expand images the grid refreshes but this time hides all the expand images apart from the ones which actually have detail records.
How can i modify this so that when the grid is refreshed based on a selection from the combo box , i get the response i 'm having (i.e hiding the expand buttons when no detail records are available)
Thanks again folks
so my code is the following
protected void RadGridRelatedStyles_PreRender(object sender, EventArgs e) |
{ |
HideExpandColumnRecursive(RadGridRelatedStyles.MasterTableView); |
} |
public void HideExpandColumnRecursive(GridTableView tableView) |
{ |
GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); |
foreach (GridNestedViewItem nestedViewItem in nestedViewItems) |
{ |
foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) |
{ |
if (nestedView.Items.Count == 0) |
{ |
TableCell cell = nestedView.ParentItem["ExpandColumn"]; |
cell.Controls[0].Visible = false; |
nestedViewItem.Visible = false; |
} |
if (nestedView.HasDetailTables) |
{ |
HideExpandColumnRecursive(nestedView); |
} |
} |
} |
} |
protected void RadComboBStyles_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
{ |
HideExpandColumnRecursive(RadGridRelatedStyles.MasterTableView); |
} |
<telerik:RadGrid ID="RadGridRelatedStyles" OnPreRender="RadGridRelatedStyles_PreRender" runat="server" AutoGenerateColumns="False" |
DataSourceID="SqlGroupStyle" GridLines="None" Skin="Gray" Width="250px" PageSize="8"> |
<HeaderContextMenu EnableTheming="True" Skin="Gray"> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
</HeaderContextMenu> |
<MasterTableView Caption="Related Group Styles" DataKeyNames="StyleTypeID" |
HierarchyLoadMode="ServerBind" DataSourceID="SqlGroupStyle" |
NoMasterRecordsText="No Available Group Styles"> |
Thanks guys/Gals