Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
whdg write to footer
posted

After looping the parent rows/columns of the grid, I want to calculate special totals of the columns and write these as strings to the footer (columns). Using e.rowisland.rows()...items() I am able to calculate the required values...but I cannot figure out how to write a client-side string to the footer (columns) row. Any help will be appreciated.

Jim Spicer

Parents
  • 33839
    Verified Answer
    posted

    Hi Jim,

    You should be able to write to a footer by setting the Text property of the Footer property of a column.   So for example, to set the text of column 0's footer in the top grid view, you could use

     this.WebHierarchicalDataGrid1.GridView.Columns[0].Footer.Text = "Hello";

    I put the following code in the hierarchical grid's DataBound event to set the sum of column 0, an integer column.

    protected void WebHierarchicalDataGrid1_DataBound(object sender, EventArgs e)
        {

            int total = 0;
            foreach (ContainerGridRecord row in this.WebHierarchicalDataGrid1.GridView.Rows)
            {
                total += int.Parse(row.Items[0].Text);
            }
            this.WebHierarchicalDataGrid1.GridView.Columns[0].Footer.Text = total.ToString();
        }

    Let us know if you need more help with this.

    regards,
    David Young

Reply Children
No Data