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

Pre-Expand Child Grid Rows and Place Child DetailTable Rows in Edit Mode?

3 Answers 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 29 Nov 2012, 02:56 AM
How do I pre-expand the grid to show the DetailsTable child items by default and also have them in edit mode as well?

This doesn't work as it obviously places the parent rows in Edit Mode:

protected void rgUnits_PreRender(object sender, EventArgs e)
        {
            for (int i = 0; i < rgUnits.MasterTableView.PageSize; i++)
            {
                rgUnits.EditIndexes.Add(i);
            }

            rgUnits.Rebind();
        }

<MasterTableView  ...
<DetailTables>
 <telerik:GridTableView...

I need it to be pre-expanded and in edit mode for the child rows.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 29 Nov 2012, 05:00 AM
Hi,

I guess you want to make the set HierarchyDefaultExpanded to true and show all the ChildItem in Edit mode. Please try the following code snippet.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
        {
            GridTableView tableView = (GridTableView)item.ChildItem.NestedTableViews[0];
            if (item.Expanded == true)
            {
                    foreach (GridItem childItem in tableView.Items)
                    {
                        GridEditableItem editableItem = childItem as GridDataItem;
                        editableItem.Edit = true//making child item editable
                    }
            }
            tableView.Rebind();
        }
}

Thanks,
Shinu.
0
Peter
Top achievements
Rank 1
answered on 30 Nov 2012, 12:11 AM
Thanks, but this doesn't seem to work. It only seems to set make the last item on the current Page of the grid editable.  Also, setting the HierarchyDefaultExpanded seems to make the Grid too slow. 

So I think I'll just leave this for now.
0
Shinu
Top achievements
Rank 2
answered on 30 Nov 2012, 04:46 AM
Hi,

Please set the RadGrid property AllowMultiRowEdit to True to make the entire RadGrid in edit mode.

ASPX:
<telerik:RadGrid id="RadGrid1" AllowMultiRowEdit="true" . . . >

Thanks,
Shinu.
Tags
Grid
Asked by
Peter
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Peter
Top achievements
Rank 1
Share this question
or