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

[Solved] What event fires when you expand a row?

5 Answers 525 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Forest
Top achievements
Rank 1
Forest asked on 17 Apr 2009, 04:15 PM
I have a grid - basic hierachy. 

Why I expand a column to open up the details table, what event fires?

I'd like to change some of the detailstable column upon expanding.

Thanks,

Forest

5 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 17 Apr 2009, 05:34 PM
Hello Forest,

Here is an example:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    if (e.CommandName == RadGrid.ExpandCollapseCommandName) 
    {  
        //your code 
    } 

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Forest
Top achievements
Rank 1
answered on 17 Apr 2009, 05:41 PM
Thanks.

When the event fires, is the detailstable already databound or not yet?

What I'm trying to do is - after expanding the row - iterate through the rows of the details table (the second level fo the heirarchy) and put them in edit mode so the user can start editing right away instead of pressing an edit button.

Any suggestions ?


0
Princy
Top achievements
Rank 2
answered on 20 Apr 2009, 04:46 AM
Hello Forest,

You can try out the following code to achieve the required scenario:
c#:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    {        
        foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items) 
        { 
            if (dataItem.Expanded) 
            {                 
                    GridTableView nestedView = (GridTableView)dataItem.ChildItem.NestedTableViews[0]; 
                
                    foreach (GridDataItem item in nestedView.Items) 
                    { 
                        item.Edit = true;                   
                        
                    } 
                    nestedView.Rebind();              
 
            } 
        }  

Thanks
Princy.
0
Forest
Top achievements
Rank 1
answered on 20 Apr 2009, 01:18 PM
I had to combine both of your solutions to get everything in edit mode.  It works, but with one problem.

The child grids do not retain their values after I change them - if I collapse a panel, it rebinds back to the original data from the db.  Anyway I can stop this and have the grid update the values for each cell.  I don't see an UpdateCell method.

Thanks,


Forest
 
0
Daniel
Telerik team
answered on 22 Apr 2009, 04:39 PM
Hello Forest,

Could you provide a demo project which illustrate your approach? We could find an appropriate solution for you when we debug your code locally. You can attach the files to formal support ticket.

Kind regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Forest
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Forest
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or