This is a migrated thread and some comments may be shown as answers.

How to expand all the RadGrid tables when exporting?

1 Answer 217 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pooya
Top achievements
Rank 1
Pooya asked on 07 Apr 2011, 02:24 PM
I have a RadGrid with 2 inner layers of details tables.

I set this.radGrid.MasterTableView.HierarchyDefaultExpanded = true; before rebinding my grid for the export but it only expands 1 inner details table. How to expand all inner details tables? Thanks,

1 Answer, 1 is accepted

Sort by
0
Pooya
Top achievements
Rank 1
answered on 07 Apr 2011, 03:43 PM
found it :)

/// <summary>
        /// Handles the DataBound event of the RadGrid control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void RadGrid_DataBound(object sender, EventArgs e)
        {
            ExpandGridTableView(this.radGrid.MasterTableView, this.ExpandGroupHeaders);
        }

        /// <summary>
        /// Expands the grid table view.
        /// </summary>
        /// <param name="gridTableView">The grid table view.</param>
        /// <param name="expand">if set to <c>true</c> [expand].</param>
        private void ExpandGridTableView(GridTableView gridTableView, bool expand)
        {
            gridTableView.HierarchyDefaultExpanded = expand;
 
            foreach (var detailTable in gridTableView.DetailTables)
            {
                ExpandGridTableView(detailTable, expand);
            }
        }



        /// <summary>
        /// Handles the DataBound event of the RadGrid control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void RadGrid_DataBound(object sender, EventArgs e)
        {
            ExpandGridTableView(this.radGrid.MasterTableView, this.ExpandGroupHeaders);
        }
        /// <summary>         /// Expands the grid table view.         /// </summary>         /// <param name="gridTableView">The grid table view.</param>         /// <param name="expand">if set to <c>true</c> [expand].</param>         private void ExpandGridTableView(GridTableView gridTableView, bool expand)         {             gridTableView.HierarchyDefaultExpanded = expand;             foreach (var detailTable in gridTableView.DetailTables)             {                 ExpandGridTableView(detailTable, expand);             }         }
        /// <summary>
        /// Handles the DataBound event of the RadGrid control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void RadGrid_DataBound(object sender, EventArgs e)
        {
            ExpandGridTableView(this.radGrid.MasterTableView, this.ExpandGroupHeaders);
        }
        /// <summary>         /// Expands the grid table view.         /// </summary>         /// <param name="gridTableView">The grid table view.</param>         /// <param name="expand">if set to <c>true</c> [expand].</param>         private void ExpandGridTableView(GridTableView gridTableView, bool expand)         {             gridTableView.HierarchyDefaultExpanded = expand;             foreach (var detailTable in gridTableView.DetailTables)             {                 ExpandGridTableView(detailTable, expand);             }         }
Tags
Grid
Asked by
Pooya
Top achievements
Rank 1
Answers by
Pooya
Top achievements
Rank 1
Share this question
or