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

RadGrid inside EditItemTemplate RadGrid How do I force Batch Update

3 Answers 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
moegal
Top achievements
Rank 1
moegal asked on 10 Feb 2014, 12:08 AM
I have a RadGrid (RadGridChild) inside a GridTemplateColumn/EditItemTemplate of another RadGrid (RadGridParent)

I want to make sure RadGridChild_BatchEditCommand is called before RadGridParent_UpdateCommand?

Is there a way to do this server side?  

Marty


3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 13 Feb 2014, 08:17 AM
Hello Marty,

On my side seems that the BatchEditCommand of the inner grid is called before the UpdateCommand event of the parent. Basically when you click the save changes of the inner grid it will call first its BatchEditCommand and after that UpdateCommand. Then if you click the save changes of the outer grid it will call the same event in the same sequence. I prepared a small sample and attached it to this thread. Please give it a try and let me know how it differs from your real setup.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
moegal
Top achievements
Rank 1
answered on 13 Feb 2014, 03:02 PM
Kostadin,

Thanks, but that is not working like I would like. I have my Outer grid(RadGrid1) set to edit using and edit template and not in batch mode. 

one of the columns has the inner grid(RadGrid2). I want to remove the save changes button on the inner grid and have the Save button from RadGrid1 save the batch changes first and then update the other changes if any in RadGrid1.

here is the working BatchEditCommand:
protected void RadGrid2_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
    {
        RadGrid grid2 = (RadGrid)sender;
        string userlevelID = ((GridEditFormItem)grid2.NamingContainer).ParentItem.GetDataKeyValue("userlevelID").ToString();
        foreach (GridBatchEditingCommand command in e.Commands)
        {
            Administrators.AdminAccess a = new Administrators.AdminAccess();
            Hashtable newValues = command.NewValues;
            Hashtable oldValues = command.OldValues;
            string usersectionID = oldValues["usersectionID"].ToString();
            a.canView = (bool)newValues["canView"];
            a.canEdit = (bool)newValues["canEdit"];
            a.canDelete = (bool)newValues["canDelete"];
            a.canInsert = (bool)newValues["canInsert"];
            a.canExport = (bool)newValues["canExport"];
            bool updatedVal = Administrators.updateUserSectionLevel(a, Convert.ToInt32(userlevelID), Convert.ToInt32(usersectionID));
        }
    }

I want to only use the RadGrid1_UpdateCommand to save the batch from the innergrid(RadGrid2) and the fields in RadGrid1.

protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
    {
//do batch update on RadGrid2 here...
}


Thanks, Marty

0
Kostadin
Telerik team
answered on 18 Feb 2014, 01:57 PM
Hi Marty,

I am afraid that the requested scenario is not supported. If you need only to get the changed values, then you could store them in a session and use the UpdateCommand of the outer grid to update your database.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
moegal
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
moegal
Top achievements
Rank 1
Share this question
or