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

NestedViewTemplate

1 Answer 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
New User
Top achievements
Rank 1
New User asked on 30 Jan 2011, 07:07 PM
I have a need to close all the nestedviewtemplates in my grid before leaving the page.  I've tried the below code and it does not close all the rows.  Any suggestions.

foreach

 

(GridItem item in rdInsLines.MasterTableView.Controls[0].Controls)

 

{

 

if (item is GridDataItem)

 

{

 

if (item.Expanded)

 

{

item.FireCommandEvent(

"ExpandCollapse", String.Empty);

 

}


}
}

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 31 Jan 2011, 09:09 AM
Hi,


I am not quite sure about your situation/requirement. RadGrid having behavior of it does not persist the expanded state after rebinding. That means if you rebind the grid, the expanded items will get collapsed.

Have you missed calling Rebind() method?


If you want t collapse the items, then the following code is enough.
protected void Button4_Click(object sender, EventArgs e)
{
    RadGrid1.MasterTableView.Rebind();
}


-Shinu.
Tags
Grid
Asked by
New User
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or