I have a web page with a WebHeirarchicalDataGrid that is loaded with data from a one table dataset. The fields in that table are dynamically determined so, I have to use Autocolumn generation and load the data in the code behind. The page uses a WHDG in order to take advantage of its Grouping and, hopefully, Summary Row capabilites.
Here's the problem. I want to enable and disable the summary rows, and their corresponding icons in the column headers, via a button on the page. When the user clicks the button the WHDG will toggle between hiding and showing the summary rows and their icons. Here is the code I've used to do so:
In the markup for the WHDG:
<igtbl:WebHierarchicalDataGrid ID="ReportsDataGrid" runat="server" > <Behaviors> <igtbl:SummaryRow enabled="false"> </igtbl:SummaryRow> </Behaviors> ...</igtbl:WebHierarchicalDataGrid>
In the codebehind button click event (C#):
if (ReportsDataGrid.Behaviors.SummaryRow.Enabled){ ReportsDataGrid.Behaviors.SummaryRow.Enabled = false;}else{ ReportsDataGrid.Behaviors.SummaryRow.Enabled = true;}
Unfortunately, this doesn't work. Obviously I am missing something here. Can you give me some info on what that might be?
Hello dpinkston,
Thank you for posting in the community.
WebHierarchicalDataGrid's behaviors should be accessed and modified through the grid's GridView, for instance:
ReportsDataGrid.GridView.Behaviors.SummaryRow.Enabled = true;
Please let me know if Enabling/Disabling the summary row behavior in this manner makes a difference.
Thank you for your reply Petar.
Enabling/Disabling the summary row at the GridView level does the job.