J'ai un Gridview que je crée un pied de page dynamique câblé à l'événement RowDataBound.Reportez-vous à la valeur Pied de page dans GridView créé dynamiquement ASP VB
Cependant, il y a une probabilité de 50/50 que 3 des colonnes n'aient aucune donnée.
Je souhaite pouvoir masquer de manière dynamique les colonnes sans données, si possible.
J'ai essayé de le faire dans l'événement RowDatabound en vérifiant si la valeur est = 0 mais cela ne fonctionne pas parce que je pense que l'événement est appelé au début? Y at-il un moyen de faire référence aux valeurs dans la ligne Pied de page après que toutes les données ont été liées?
Idéalement situé dans 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`
Il peut être utile d'inclure votre code. – Bryan
Également utilisez-vous. Net? ou juste asp? – Bryan
oui. Postez votre code. Je suis sûr que je peux aider .... – Eric