mumick Posted April 20, 2005 Posted April 20, 2005 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. <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 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 Quote
kahlua001 Posted April 20, 2005 Posted April 20, 2005 Try... <asp:DataGrid id="dgFooter" runat="server" ShowFooter="True" > Quote
mumick Posted April 20, 2005 Author Posted April 20, 2005 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.