VB.NET - GridView Grouping,Subtotal & Grandtotal rows

Asked By Alican on 30-Jun-11 04:54 AM
I am looking for Vb code of gridview table with subtotals and grand total and Grouping at the same time


but i would like to change column names like Orderdate,Productname,ProductId(group by),GroupId,Warehouse,Quantity

Thanks all.
Ravi S replied to Alican on 30-Jun-11 05:20 AM

for subtotal

Protected Sub GridView1_RowDataBound(sender As Object, e As GridViewRowEventArgs)

	If e.Row.RowType = DataControlRowType.DataRow Then

		Dim gv As GridView = TryCast(e.Row.FindControl("gvReports"), GridView)

		Dim footerRow As GridViewRow = gv.FooterRow

		For Each row As GridViewRow In gv.Rows

			Dim labelTotal As Label = TryCast(footerRow.FindControl("lblTotal"), Label)

			dayHour += [Double].Parse(TryCast(row.FindControl("lblHour"), Label).Text)

			labelTotal.Text = dayHour.ToString()

		totalHour += dayHour

		dayHour = 0.0
	End If

End Sub

refer the link for details

for conversion refer this link
Alican replied to Ravi S on 30-Jun-11 06:04 AM
thank you ravi for link i will try them but i tried that converter before it wasnt good at all .
Mihir Soni replied to Alican on 30-Jun-11 07:52 AM

You can use following gridview it's fully functionally and you can do many operations on gridview data



thank you
Alican replied to Mihir Soni on 30-Jun-11 08:28 AM
thank you Mihir i tried that codes yesterday its working in C# but when i translate to VB it doesnt work :/