Hi I am trying to hid / show the footer when a user expands or collapses and item in the grid view, how can I achieve this
ok so I now have this code
this is only checking the first item in the grid I would like it to test if any items are expanded
I would like it to check if any items are expanded if they are hide the footer, if the item is collapsed then show the footer
thanks
M
ok so I now have this code
if (gvTakeoff.Items.Expanded == false) { gvTakeoff.MasterTableView.ShowFooter = false; } else { gvTakeoff.MasterTableView.ShowFooter = true; }if (gvTakeoff.Items[0].Expanded == false) { gvTakeoff.MasterTableView.ShowFooter = false; } else { gvTakeoff.MasterTableView.ShowFooter = true; }I would like it to check if any items are expanded if they are hide the footer, if the item is collapsed then show the footer
thanks
M
8 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 30 Jan 2013, 12:43 PM
Hi Mike
Try the following code snippet to hide/show footer on Expand or collapse click.
C#:
Thanks,
Princy.
Try the following code snippet to hide/show footer on Expand or collapse click.
C#:
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.CommandName == "ExpandCollapse") { if (e.Item.Expanded) { RadGrid1.ShowFooter = false; } else { RadGrid1.ShowFooter = true; } } }Thanks,
Princy.
0
Mike
Top achievements
Rank 1
answered on 30 Jan 2013, 01:02 PM
Hi thanks for the reply I tried that but it does not hide the footer.
0
Princy
Top achievements
Rank 2
answered on 31 Jan 2013, 07:27 AM
0
Princy
Top achievements
Rank 2
answered on 31 Jan 2013, 07:52 AM
Hi,
Please try the following code snippet to hide the footer on expanding.
C#:
CSS:
Please ignore the previous attachment.
Regards,
Princy.
Please try the following code snippet to hide the footer on expanding.
C#:
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.CommandName == "ExpandCollapse") { if (e.Item.Expanded) { RadGrid1.FooterStyle.CssClass = "show"; } else { RadGrid1.FooterStyle.CssClass = "hide"; } } }CSS:
<style type="text/css">.hide{ display:none !important;}.show{ display:;}</style>Please ignore the previous attachment.
Regards,
Princy.
0
Mike
Top achievements
Rank 1
answered on 31 Jan 2013, 01:26 PM
Hi I have tried your code but that just stopped any of my rows in the grid view from being displayed.
This code works fine for hiding the first row which I have added to the Grid_DataBound
It does not hide the footer when the row is closed
This code works fine for hiding the first row which I have added to the Grid_DataBound
if (gvTakeoff.Items[0].Expanded == false) { gvTakeoff.MasterTableView.ShowFooter = false; } else { gvTakeoff.MasterTableView.ShowFooter = true; }It does not hide the footer when the row is closed
0
Princy
Top achievements
Rank 2
answered on 01 Feb 2013, 11:53 AM
Hi Mike,
Can you please try the following code snippet?
C#:
Thanks,
Princy.
Can you please try the following code snippet?
C#:
public static bool anyItemExpanded = false; protected void RadGrid1_ItemCommand1(object sender, GridCommandEventArgs e) { if (e.CommandName == "ExpandCollapse") { if (e.Item.Expanded) { foreach (GridDataItem item in RadGrid1.MasterTableView.Items) { if (item.Expanded && item.ItemIndex != e.Item.ItemIndex) { anyItemExpanded = true; break; } } } else { anyItemExpanded = true; } } } protected void RadGrid1_PreRender(object sender, EventArgs e) { if (anyItemExpanded) { RadGrid1.MasterTableView.ShowFooter = false; anyItemExpanded = false; } else { RadGrid1.MasterTableView.ShowFooter = true; RadGrid1.MasterTableView.Rebind(); } }Thanks,
Princy.
0
Mike
Top achievements
Rank 1
answered on 01 Feb 2013, 03:51 PM
Hi thanks for the reply that does not work either I have included screen shots to show what I am expecting to happen
1st picture initial view
2nd picture what happens currently when I click expand
3rd picture what I would like to happen when I click expand
the code I am using
1st picture initial view
2nd picture what happens currently when I click expand
3rd picture what I would like to happen when I click expand
the code I am using
public static bool anyItemExpanded = false;
protected void gvTakeoff_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "ExpandCollapse") { if (e.Item.Expanded) { foreach (GridDataItem item in gvTakeoff.MasterTableView.Items) { if (item.Expanded && item.ItemIndex != e.Item.ItemIndex) { anyItemExpanded = true; break; } } } else { anyItemExpanded = true; } } if (e.CommandName == "RowClick" && e.Item.OwnerTableView.Name == "Details") { GridDataItem item = (GridDataItem)e.Item; if (item.Edit == false) { item.Edit = true; gvTakeoff.Rebind(); } } } protected void gvTakeoff_PreRender(object sender, EventArgs e) { if (anyItemExpanded) { gvTakeoff.MasterTableView.ShowFooter = false; anyItemExpanded = false; } else { gvTakeoff.MasterTableView.ShowFooter = true; gvTakeoff.MasterTableView.Rebind(); } } long takeoffSectionId; protected void dsTakeoffItems_Deleting(object sender, SqlDataSourceCommandEventArgs e) { WDBDataContext dc = new WDBDataContext(); long takeoffItemId = (long)e.Command.Parameters["@ID"].Value; takeoffSectionId = dc.TakeoffSectionItems.Where(a => a.ID == takeoffItemId).Select(a => a.TakeoffSectionID).Single(); }0
Hi Mike ,
I tested any of the suggestions Princy has provided in this thread and all of them work properly on my end. Therefore could you please open a regular support ticket and send us a sample application with the mentioned suggestions implemented which shows that they does not work on your end? Thus we will be able to revise the application locally and isolate the scenarios specifics that are causing this solutions to fail for you.
Kind regards,
Maria Ilieva
the Telerik team
I tested any of the suggestions Princy has provided in this thread and all of them work properly on my end. Therefore could you please open a regular support ticket and send us a sample application with the mentioned suggestions implemented which shows that they does not work on your end? Thus we will be able to revise the application locally and isolate the scenarios specifics that are causing this solutions to fail for you.
Kind regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.