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

Batch Edit Grid inside FormView

2 Answers 13 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 05 Feb 2015, 03:58 PM
Hi Konstantin,

I mentioned in the other post that I'd have uses for the RadGrid with Batch Editing.  Well I'm pushing the bounds as normal and have hit a snag.

I have a formview control and within it a RadGrid.  I want to save the content of the RadGrid at the same time that the user saves the data from the FormView.

One way that i can think of doing this is to save the radgrid data and then in the ajax callback call a function that will then save the formview data.  An obvious issue here is that the child data is being saved before the parent data.  This will need a database work around but is achievable.

Is my solution described there the best or is there some way that I could get the grid data saved from within the formview save events?

Best Regards

Jon

2 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 10 Feb 2015, 12:20 PM
Hi Jon,

The only possible way for passing the changes made on the grid with Batch Editing is even by clicking on the "Save Changes" button or by manually calling on of the BatchEditingManager methods that will initiate the saving. 

The only approach that you could look into is to use an external button to save the changes in the grid (through the BatchEditingManager) and retrieve the data outside the grid within the OnBatchEditCommand event:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function saveAll() {
            var grid1 = $find("<%=RadGrid1.ClientID%>");
            var batchManager1 = grid1.get_batchEditingManager();
            batchManager1.saveTableChanges([grid1.get_masterTableView()]);
        }
    </script>
</telerik:RadCodeBlock>
 
<telerik:RadButton runat="server" ID="RadButton1" AutoPostBack="false" Text="Save all" OnClientClicked="saveAll"></telerik:RadButton>

Hope this helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jon
Top achievements
Rank 1
answered on 11 Feb 2015, 01:06 PM
Hi Konstantin

Thanks for that.  In the end I simplified the page by moving the grid outside of the formview.

I then made it so that the formview was submitted as normal if there were no changes in the grid.  When changes were in teh grid I count the saves off till it hits 0 and then I trigger a formview save from the codebehind.

It's a little messy but it works :)

Regards

Jon
Tags
Grid
Asked by
Jon
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Jon
Top achievements
Rank 1
Share this question
or