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

expand row 2 should close any edit or insert

2 Answers 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Khanh
Top achievements
Rank 1
Khanh asked on 28 May 2010, 07:56 PM
Hi there,

I have parent grid and a detailstable.  The parent has inline edit.  When I click on row 1, it goes into edit mode correctly.  Now I click to expand row 5.  Row 5 expands correctly but row 1 is still in edit mode.  Clicking inside the expanded grid causes a "can't load viewstate."  This happens to insert as well.

Using RadGrid1.MasterTableView.ClearEditItems() has no effect nor does item.edit=false

When I expand any row, I would like edit/insert on the parent grid to close.

Thanks for any assistance.
Khanh

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 01 Jun 2010, 07:25 AM
Hello Khanh,

Check out the following code snippet to close the insert/edit form in parent table when expanding the row of the grid.

C#:
 protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == "ExpandCollapse"  && !e.Item.Expanded)  
        {           
                RadGrid1.MasterTableView.ClearEditItems(); 
                RadGrid1.MasterTableView.IsItemInserted = false
                RadGrid1.MasterTableView.Rebind(); 
                RadGrid1.MasterTableView.Items[e.Item.ItemIndex].Expanded = !RadGrid1.MasterTableView.Items[e.Item.ItemIndex].Expanded; 
                       
        } 
    } 

Thanks,
Princy.


0
Khanh
Top achievements
Rank 1
answered on 01 Jun 2010, 12:48 PM
Perfect!!!  Thanks, Princy.
Tags
Grid
Asked by
Khanh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Khanh
Top achievements
Rank 1
Share this question
or