<asp:datagrid id="rec1" Runat="server" border="1" 

cellpadding="6" cellspacing="0" onItemDataBound="Record1" 
AutoGenerateColumns="False" ShowFooter="True">

<HeaderStyle Font-Size="9pt" ForeColor="LightCyan" 

Font-Names="Verdana" Font-Bold="True" BackColor="Navy">

</HeaderStyle>

<FooterStyle BackColor=#9999cc ></FooterStyle>

 

<Columns>

              

<asp:BoundColumn  DataField="Family" HeaderText="Family"></asp:BoundColumn>

<asp:BoundColumn Visible=False DataField="AFamily" 
HeaderText="Family"></asp:BoundColumn>

<asp:BoundColumn DataField="Total" HeaderText="Total"></asp:BoundColumn>

 

</Columns>

 

</asp:datagrid>

 

Sub Binds2()

        Dim con As SqlConnection

        Dim cmd As SqlCommand

        Dim da As SqlDataAdapter

        Dim ds As DataSet

        con = New SqlConnection("server=lc2000;uid=sa;pwd=;database=admin")

        da = New SqlDataAdapter("select Family,Afamily,Total from product ", 
con)------------

        da.SelectCommand.CommandType = CommandType.StoredProcedure

        

        ds = New DataSet

        da.Fill(ds, "rptnewAssetClassification2")

 

        Dim curCat As String

        Dim prevCat As String

        Dim i As Integer = 0

 

     Do While i <= ds.Tables(0).Rows.Count - 1

     curCat = ds.Tables(0).Rows(i).Item("Assetsubclass")

        If curCat <> prevCat Then

        prevCat = curCat

        Dim shRow As DataRow = ds.Tables(0).NewRow

          shRow("Family") = ds.Tables(0).Rows(i).Item(0)

                shRow("AFamily") = "subhead1"

                ds.Tables(0).Rows.InsertAt(shRow, i)

                i += 1

            End If

            i += 1

        Loop

        rec1.DataSource = ds.Tables"rptnewAssetClassification2")

        rec1.DataBind()

        

        da.Dispose()

        con.Close()

    End Sub

 

Sub Record1(ByVal sender As Object, 

ByVal e As DataGridItemEventArgs)

    Select Case e.Item.ItemType

    Case ListItemType.AlternatingItem, ListItemType.Item

      If e.Item.Cells(1).Text.Equals("subhead1") Then

      e.Item.Cells(0).HorizontalAlign = HorizontalAlign.Left

      e.Item.Cells(0).ColumnSpan = 1

      e.Item.Cells(0).Font.Bold = True

 

      e.Item.Cells.RemoveAt(1)

      e.Item.BackColor = Color.FromArgb(150, 150, 180)

      End If

   End Select

 

 

    End Sub

 ---------------------

 

I want to Find the Total for Each Section. 

 

Please Help me.


                
---------------------------------
 Too much spam in your inbox? Yahoo! Mail gives you the best spam protection 
for FREE!
http://in.mail.yahoo.com

[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to