Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 237423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:25:27+00:00 2026-05-11T20:25:27+00:00

I have a Gridview that I create a dynamic footer wired up to the

  • 0

I have a Gridview that I create a dynamic footer wired up to the RowDataBound event.

However there is a 50/50 chance that 3 of the columns will have no data.

I want to be able to dynamically hide the columns with no data if possible.

I have tried doing this in the RowDatabound event by checking if the value is = 0 but that does not work because I think the event is called to early?

Is there anyway to refer to the values in the Footer row after ALL the data has been bound?

Ideally in VB

`Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound




    If e.Row.RowType = DataControlRowType.DataRow Then
        TotalOffered += DataBinder.Eval(e.Row.DataItem, "Offered")
        TotalHandled += DataBinder.Eval(e.Row.DataItem, "Handled")
        TotalHandled30 += DataBinder.Eval(e.Row.DataItem, "Handled30")
        TotalHandlingTime += (DataBinder.Eval(e.Row.DataItem, "AHT") * DataBinder.Eval(e.Row.DataItem, "Handled"))
        TotalTalkTime += ((DataBinder.Eval(e.Row.DataItem, "AHT") * DataBinder.Eval(e.Row.DataItem, "Talk"))) * DataBinder.Eval(e.Row.DataItem, "Handled")
        TotalHoldTime += ((DataBinder.Eval(e.Row.DataItem, "AHT") * DataBinder.Eval(e.Row.DataItem, "Hold"))) * DataBinder.Eval(e.Row.DataItem, "Handled")
        TotalWrapTime += ((DataBinder.Eval(e.Row.DataItem, "AHT") * DataBinder.Eval(e.Row.DataItem, "Work"))) * DataBinder.Eval(e.Row.DataItem, "Handled")

        ' If there is agent data calculate a running total
        If IsDBNull(DataBinder.Eval(e.Row.DataItem, "Pri_Agent_Sign_in")) Then
            GridView1.Columns(0).Visible = False


        Else
            TotalSignedin += DataBinder.Eval(e.Row.DataItem, "Pri_Agent_Sign_in")
            TotalAvail += DataBinder.Eval(e.Row.DataItem, "Pri_Agent_Sign_in") * DataBinder.Eval(e.Row.DataItem, "Avail_Time")
            TotalIdle += DataBinder.Eval(e.Row.DataItem, "Pri_Agent_Sign_in") * DataBinder.Eval(e.Row.DataItem, "Unavail_Time")



        End If

        ' If there is forecast data calculate a running total

        If IsDBNull(DataBinder.Eval(e.Row.DataItem, "ORG_FOR_VOL")) Then


        Else
            TotalForecastVolume += DataBinder.Eval(e.Row.DataItem, "ORG_FOR_VOL")
            TotalForecastAHT += DataBinder.Eval(e.Row.DataItem, "ORG_FOR_VOL") * DataBinder.Eval(e.Row.DataItem, "ORG_FOR_AHT")
        End If



    ElseIf e.Row.RowType = DataControlRowType.Footer Then
        e.Row.Cells(0).Text = "Totals : "
        e.Row.Cells(1).Text = TotalOffered.ToString
        e.Row.Cells(2).Text = TotalHandled.ToString
        e.Row.Cells(3).Text = TotalHandled30.ToString
        e.Row.Cells(4).Text = (TotalHandled / TotalOffered).ToString("#0%")
        e.Row.Cells(5).Text = (TotalHandled30 / TotalHandled).ToString("#0%")
        e.Row.Cells(6).Text = (TotalHandlingTime / TotalHandled).ToString("N0")
        e.Row.Cells(7).Text = (TotalTalkTime / TotalHandlingTime).ToString("#0%")
        e.Row.Cells(8).Text = (TotalHoldTime / TotalHandlingTime).ToString("#0%")
        e.Row.Cells(9).Text = (TotalWrapTime / TotalHandlingTime).ToString("#0%")


        ' If agent data then add total data to footer
        If TotalSignedin = 0 Then

        Else

            e.Row.Cells(11).Text = (TotalAvail / TotalSignedin).ToString("#0%")
            e.Row.Cells(12).Text = (TotalIdle / TotalSignedin).ToString("#0%")
            e.Row.Cells(12).HorizontalAlign = HorizontalAlign.Center

        End If

        If TotalForecastVolume = 0 Then

        Else

            e.Row.Cells(13).Text = TotalForecastVolume.ToString
            e.Row.Cells(14).Text = (TotalForecastAHT / TotalForecastVolume).ToString("F0")

        End If

    End If`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:25:27+00:00Added an answer on May 11, 2026 at 8:25 pm

    If i correctly understand what your asking, then the code you want should look something like this (I’m using vb.net 2008 and the closest item i have to a grid view is DataGridView. if your using aspx then let me know and i’ll generate some code for it):

    For i = 0 To DataGridView1.ColumnCount - 1
            If DataGridView1.Rows(0).Cells(i).Value = "" Then
                DataGridView1.Columns(i).Visible = False
            End If
        Next
    

    This is of course code for after the grid is filled.

    Here is the code you could put into your aspx.vb file after your GridView is completely loaded:

    For i = 0 To GridView1.Columns.Count - 1
            If GridView1.FooterRow.Cells(i).Text = "" Then
                GridView1.Columns(0).Visible = False
            End If
        Next
    

    If you want to hide the column as you populate the gridview then you will have to put up your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer SVN cannot handle non-linear history (it simply has no notation… May 12, 2026 at 12:58 am
  • Editorial Team
    Editorial Team added an answer Emacs can be better that Eclipse, but the question is… May 12, 2026 at 12:58 am
  • Editorial Team
    Editorial Team added an answer I would add Mocha. If you use Cucumber, Rspec or… May 12, 2026 at 12:58 am

Related Questions

In the application I'm working on porting to the web, we currently dynamically access
I have an aspx page that has a control which serves as a summary
I'm sure that almost everyone programming in .net has ran into similar issues with
I'm new to MVC, and am not following how you'd do paging and sorting

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.