bind datagrid footer

mumick

Newcomer
Joined
Apr 20, 2005
Messages
2
Location
Milwaukee, WI
Does anyone know how to bind multiple labels in the datagrid footer.
I tried to do it today but I could't. I can bind labels in the DataGrid columns but not in the footer.
My html code is below:
For the test purposes I use the same database field for all labels.

Code:
<asp:DataGrid id="dgFooter" runat="server">
<Columns>
  <asp:TemplateColumn>
    <ItemTemplate>
      <asp:Label ID=Label1 text='<%# DataBinder.Eval      
      (Container.DataItem, "InstallEach")%>' Runat=server></asp:Label>
    </ItemTemplate>
    <FooterTemplate>
      <asp:Label ID="Label2" text='<%# DataBinder.Eval  
      (Container.DataItem, "InstallEach")%>' Runat=server>
      </asp:Label><br />
      <asp:Label ID="Label3" text='<%# DataBinder.Eval
      (Container.DataItem, "InstallEach")%>' Runat=server>
      </asp:Label>
    </FooterTemplate>
  </asp:TemplateColumn>
</Columns>
</asp:datagrid>

my code behind is

Code:
Protected Shared strSQL As String = ConfigurationSettings.AppSettings("Connection")

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Dim dbConn As New SqlConnection(strSQL)
            Dim cmd As New SqlCommand("SELECT TOP 10 InstallEach, ProductID, Identifier FROM PP WHERE InstallEach > 10", dbConn)
            Dim daGrid As New SqlDataAdapter(cmd)
            Dim dsGrid As New DataSet

            daGrid.Fill(dsGrid, "Products")
            With dgTest
                .DataSource = dsGrid.Tables("Products").DefaultView
                .DataBind()
            End With

            dsGrid.Dispose()
            daGrid.Dispose()
            dbConn.Close()
        Catch ex As Exception
            Response.Write(ex.Message())
        End Try
    End Sub

Any thoughts on it.
Thanks, mumick
 
kahlua001 said:
Try...
<asp:DataGrid id="dgFooter" runat="server" ShowFooter="True" >

I forgot to copy it into my question. I do have showfooter set to true. There is something else prevents datagrid footeritem from binding.
but thanks anyway, mumick
 
Back
Top