Thanks in advance.
20 Answers, 1 is accepted
You can use the following approach to achieve the requested functionality:
grid.get_batchEditingManager().saveChanges(grid.get_masterTableView());
Hope this helps. Please give it a try and let me know if it works for you.
Regards,
Eyup
Telerik

I don't know where the method
get_batchEditingManager(
) can be found. Are you talking about using a new instance of the grid.RadGrid grid = (this.FindControl("gridItems") as RadGrid);
and then saying
grid.get_batchEditingManager().saveChanges(grid.get_masterTableView());
If that is the case then get_batchEditingManager() is not correct.
Thanks,
Steve
Here is a basic sample demonstrating how the suggested method can be used on a button click:
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Button"
OnClientClick
=
"initSaveAllCommand(); return false;"
/>
function
initSaveAllCommand(sender, args) {
var
grid = $find(
"<%= RadGrid1.ClientID %>"
);
grid.get_batchEditingManager().saveChanges(grid.get_masterTableView());
}
That should do the trick.
Regards,
Eyup
Telerik

The code you have given works well in all the browsers other than IE 9,
Do you have any fix or work around for it.
$(
'.SS'
).each(
function
() {
var
gridID = $(
this
).attr(
'value'
);
var
grid = $find(gridID);
grid.get_batchEditingManager().saveChanges(grid.get_masterTableView()); //this line does not work in IE9
});
Since the above code is not working in IE9, the save changes method is not getting triggered.
Thanks
Vino
On my side the suggested approach works correctly on all browsers. Can you please run the attached web site and let us know if it works as expected from your end, too?
Regards,
Eyup
Telerik

Yes the suggested approach will work for a page containing one grid. But when we have a screen where more than one Grid with batch edit mode, the problem starts here.
I am calling the save change for each grid one by one in javascript. But only the first grid is getting saved.
Thanks
Vino
You can use the new saveTableChanges method to achieve the requested simultaneous updating operation:
http://www.telerik.com/help/aspnet-ajax/grid-batch-editing.html
Hope this helps.
Regards,
Eyup
Telerik

Why?
I am glad that you have managed to find the answer by yourself as stated in the following thread:
http://www.telerik.com/community/forums/aspnet-ajax/grid/default-empty-grid-to-insert-mode-on-form-load.aspx
I suggest that we continue our conversation in the mentioned thread to enable other developers with similar issues to track the discussion more easily.
Regards,
Eyup
Telerik

grid.get_batchEditingManager().saveChanges(grid.get_masterTableView()); //this line does not work in IE9
Thanks.

Thanks.

<
asp:Button
ID
=
"btnSave"
runat
=
"server"
Text
=
"Save"
CausesValidation
=
"true"
ToolTip
=
"Save Data"
OnClick
=
"btnSave_Click"
OnClientClick
=
"initSaveAllCommand(); return false;"
/>
You can use the following event handler to achieve the requested functionality:
protected
void
RadGrid1_BatchEditCommand(
object
sender, GridBatchEditingEventArgs e)
{
SaveExternalControls();
}
For additional details, you can check the following article:
http://www.telerik.com/help/aspnet-ajax/grid-batch-editing.html
Hope this helps.
Regards,
Eyup
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.

Hi Admin,
I've used this grid.get_batchEditingManager().saveChanges(grid.get_masterTableView()); to submit request to server.
Everything looks good in Chrome and Firefox but it's not working on IE.
Please help advise.
Thanks,
Hieu
Please make sure that you are using the latest release version:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx
If the issue remains, you can open a formal support ticket and elaborate on your specific scenario.
Regards,
Eyup
Telerik

What if there are multiple RadGrids on the page? I do not want to process the SaveExternalControls() multiple times (1 for each RadGrid). Assuming there are 2 grids, I want to process the data from both grids and after that, do a one time save (to the datasource).
[quote]Eyup said:Hi Austin,
protected
void
RadGrid1_BatchEditCommand(
object
sender, GridBatchEditingEventArgs e)
{
SaveExternalControls();
}
[/quote]
You can try to pass multiple tableview objects to the saveTableChanges(tableViews) method to achieve this requirement:
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing#client-side-gridbatchediting-api
Hope this helps.
Regards,
Eyup
Telerik

Hi,
I'm using external button to save two radgrids in batch edit mode. It's working fine with below code.
I have only one issue, if one grid have required validation fires.
below code still work !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function saveTowGrids() {
try{
var grid1 = $find("<%= RadGrid1.ClientID %>");
var masterTable1 = grid1.get_masterTableView();
var grid2 = $find("<%= RadGrid2.ClientID %>");
var masterTable2 = grid2.get_masterTableView();
var batchEditManager = grid2.get_batchEditingManager();
var tables = [];
tables.push(masterTable1);
tables.push(masterTable2);
batchEditManager.saveTableChanges(tables);
alert("save completed");
} catch (e) { alert(e);}
}
For others convenience, I am pasting the answer from the answer from the other forum thread, where you have asked the same question:
"You could use the BatchEditingManager and see if there is open row or cell for editing and initiate the saving only if no cell/row is opened:
<
telerik:RadCodeBlock
runat
=
"server"
>
<
script
>
function saveGrid(sender, args) {
var grid = $find("<%= RadGrid1.ClientID%>");
var tableView = grid.get_masterTableView();
var batchManager = grid.get_batchEditingManager();
if (batchManager.get_currentlyEditedRow() || batchManager.get_currentlyEditedCell()) {
alert("pending editing");
}
else {
alert("could initiate save");
//initate the save through the BatchEditingManager
}
}
</
script
>
</
telerik:RadCodeBlock
>
Kind Regards,
Konstantin Dikov
Telerik

Looking back over my old posts. This is how I got my solution to work; i.e. using an external button to save multiple batch edit grids all at once AND saving all the UI on the page outside the grids as well:
<%--//This triggers the save process on the server side for each RG on the page. --%>
function initSaveAllCommand(sender, args) {
if (Page_ClientValidate("")) {
var grid;
var tableViews = [];
<%--//For each of the objects on the page with the CSS class 'RG' attached (which I attached to each rad grid)... --%>
$('.RG').each(function () {
<%--//...Get the ID of the object (the rad grid) --%>
grid = $find($(this).attr('id'));
<%--//and then add a pointer to the 'master table view' into the 'table views' array to use below in 'save table changes' --%>
tableViews.push(grid.get_masterTableView());
});
<%-- I use this hidden input field to make note to call the 'save' logic from the page's post back --%>
hdfSaveIsNeeded.val('true');
<%--//We need to grab ANY ONE of the batch editing managers on the page and fire the 'saveTableChanges' from it. --%>
rgGridOne.get_batchEditingManager().saveTableChanges(tableViews);
}
}