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

EditAll function for DetailTable

2 Answers 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chelsea Leonhart
Top achievements
Rank 1
Chelsea Leonhart asked on 07 May 2010, 09:10 AM
Hi Telerik team,

Currently, the EditAll command will turn every row regardless in MasterTable or DetailTable into editable form.

Could we implement a "Edit All" function that only apply for the rows in a chosen detail table?
I mean that each detail table has it own "Edit All" command button; and only rows in the detail table which its "Edit All" button is clicked turn in to editable form.

Thanks a lot.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 07 May 2010, 10:04 AM
Hello,

Try the following code snippet and see whether it helps.

C#:
 
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == "EditAllRows"
        { 
            GridCommandItem commandItem = (GridCommandItem)e.Item;            
            foreach(GridDataItem item in commandItem.OwnerTableView.Items) 
            { 
                item.Edit = true
            } 
            commandItem.OwnerTableView.Rebind(); 
        } 
    } 
[Note: I have button placed in CommandItemTemplate with CommandName set as "EditAllRows"]


Regards,
Princy.
0
Chelsea Leonhart
Top achievements
Rank 1
answered on 09 May 2010, 04:31 AM
Thank you a lot, Princy.

Your solution works fine for me.
Tags
Grid
Asked by
Chelsea Leonhart
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Chelsea Leonhart
Top achievements
Rank 1
Share this question
or