I have a datagrid where I am summing values in the ItemDataBound as I go along. Then, in the footer, I enter this sum. e.g:
<asp:TemplateColumn HeaderText="Issues">
<ItemTemplate><%# IIf(IsIssuesDefected(DataBinder.Eval(Container.DataItem, "Issues"), 2), DataBinder.Eval(Container.DataItem, "lvservice_vHorizontalClearanceIssues"), "")%>
</ItemTemplate>
<FooterTemplate><%# IssuesDefectedCount %></FooterTemplate>
</asp:TemplateColumn>
So basically, I only display the value in the cell if it is an issue, and then place the sum of the issues at the bottom. I have a lot of columns like this.
What I require next is to hide the columns if the sum is zero. However, the following code does not work:
Private Sub HideColumnsWithNoDefects()
Dim columnIndex As Integer = 0
While columnI ...
Go to the complete details ...