I use the following code in OnRowDataBound for getting the column sum
in a GridView:
Protected Sub dg(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Session("intAccountGroup") =
DataBinder.Eval(e.Row.DataItem, "AccountGroup")
End If
If e.Row.RowType = DataControlRowType.Footer Then
Dim txtSumB As TextBox =
CType(e.Row.FindControl("txtSumB"), TextBox)
txtSumB.Text = Generic_db.GetValue("SELECT Sum(Budget) FROM
vwOverview WHERE AccountGroup=" & Session("intAccountGroup") & " And
Positions=4")
End If
End Sub
I've been trying to replace the session value above with a variable but
it doesn't work because it doesn't contain any value for some reason. I
still have the feeling that there is some way to use a variable instead
of the session. Can someone please help me?
Regards,
S