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

[Solved] Issue with changing selected items of Detailtable to edit mode

3 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ravikumar
Top achievements
Rank 1
Ravikumar asked on 08 Jul 2009, 10:49 AM
Hi,

I am having a hierarchial grid which is created dynamically and can have n level of hierarchy with each level having one detail table.
I create template columns dynamically and add it to the grid and use "ServerOnDemand" for hierarchial load mode.
My issue is when i change the parent item to edit mode, its relevant detail table records also should be changed to edit mode.

How can i set the particular rows of the child detail table to edit template?

Can anyone help in solving this issue.

Thanks in Advance
Ravikumar

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Jul 2009, 06:06 AM
Hi Ravi,

Try the following code snippet to set the Detail table in edit mode when its corresponding parent row is in edit mode.

CS:
 
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            if (item.Edit && item.HasChildItems) 
            { 
                GridTableView childTable = (GridTableView)item.ChildItem.NestedTableViews[0]; 
 
                foreach (GridDataItem childitem in childTable.Items) 
                { 
                    childitem.Edit = true
                } 
            } 
        } 
        RadGrid1.MasterTableView.Rebind(); 
 
    } 


Thanks
Shinu



0
Ravikumar
Top achievements
Rank 1
answered on 09 Jul 2009, 07:40 AM
Hi Shinu,

Thanks for your suggestion. When i implement the code snippet, the child table details get cleared after calling the RadGrid1.MasterTableView.Rebind();. When i remove the rebind the data is getting displayed but in read only mode.

I am using DetailsTableDataBind() event to bind data to the child table.
Do we need to perform any specific operation when using DetailsTableDataBind() event?

Thanks in Advance
Ravikumar
0
Accepted
Princy
Top achievements
Rank 2
answered on 09 Jul 2009, 08:23 AM
Hi Ravi,

Go through the following code library submission which explains how to persist the  expanded/selected state in hierarchy on rebind.
Retain expanded/selected state in hierarchy on rebind

Princy
Tags
Grid
Asked by
Ravikumar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ravikumar
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or