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

Expand Programmatically

1 Answer 161 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Developer Developer
Top achievements
Rank 1
Developer Developer asked on 17 Jul 2008, 04:41 PM
Is there an easy way to programmatically expand a row in a hierarchy?  For example, when the page loads I would like to expand the first three rows, but leave the remaining rows collapsed.  Any help would be greatly appreciated.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Jul 2008, 05:45 AM
Hello,

You can try implementing the following code snippet to expand specific rows on page load in a hierarchy.

CS:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem dataitem in RadGrid1.MasterTableView.Items) 
        { 
            if ((dataitem.ItemIndex == 0) || (dataitem.ItemIndex == 1) || (dataitem.ItemIndex == 2)) 
            { 
                dataitem.Expanded = true
            } 
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Developer Developer
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or