Results 1 to 9 of 9

Thread: Multiple row summary in datadgrid footer. (RESOLVED!)

Threaded View

  1. #1

    Thread Starter
    Member mumick's Avatar
    Join Date
    Apr 2005
    Location
    Milwaukee, WI
    Posts
    35

    Resolved Multiple row summary in datadgrid footer. (RESOLVED!)

    Hi everyone,
    I am having a datagrid and I want to add a summary footer to it. The thing is I want to display multiple rows containing textboxes in the footer not only one. When I added template columns with textboxes to my footer and used DataBind.Eval function to bind those rows in the footer, it didn't work, textboxes are empty. Is there a special data binding function for the datagrid footer.
    My code is below. For testing purposes I use the same field to populate textboxes.

    HTML Code:
    <asp:DataGrid id="dgFooter" runat="server" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
         BackColor="White" CellPadding="3" ShowFooter="True" AutoGenerateColumns="False">
         <FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
         <SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle>
         <ItemStyle ForeColor="#000066"></ItemStyle>
         <HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#006699"></HeaderStyle>
         <Columns>
          <asp:TemplateColumn>
           <ItemTemplate>
            <asp:TextBox ID="txtBox" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "InstallEach")%>' Width="70px">
            </asp:TextBox>
           </ItemTemplate>
           <FooterTemplate>
            <asp:TextBox ID="Textbox1" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "InstallEach")%>' Width="70px">
            </asp:TextBox>
            <br />
            <asp:TextBox ID="Textbox2" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "InstallEach")%>' Width="70px">
            </asp:TextBox>
           </FooterTemplate>
          </asp:TemplateColumn>
         </Columns>
         <PagerStyle HorizontalAlign="Left" ForeColor="#000066" BackColor="White" Mode="NumericPages"></PagerStyle>
        </asp:DataGrid>

    VB Code:
    1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2. Dim strConn As String = "server=desktop;database=Beta;uid=sa;pwd=;"
    3. Dim Conn As New SqlConnection(strConn)
    4. Dim cmd As New SqlCommand("Select ProductID, InstallEach From Products", Conn)
    5. Dim daGrid As New SqlDataAdapter(cmd)
    6. Dim dsGrid As New DataSet
    7. daGrid.Fill(dsGrid, "Products")
    8. With dgFooter
    9. .DataSource = dsGrid.Tables("Products").DefaultView
    10. .DataBind()
    11. End With
    12. daGrid.Dispose()
    13. dsGrid.Dispose()
    14. Conn.Close()
    15. End Sub


    Thanks in advance, mumick.
    Last edited by mumick; May 1st, 2005 at 03:21 AM. Reason: the problem has been resolved.
    What boots up must come down.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width