IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
Sometimes it may require that you want to save all the items on a grid in one operation. Like, if your grid renders some textbox with some property values from the same class and on "binder.SaveChanges()" you want to save them as whole, rather each item per request.
To enable batch operation on a grid, first enable the batch operation in the grid. Like on the button save event you need to do the following:
function
SaveChanges() {
// turn on the batch save
formBinder.set_batchSave(
true
);
// call the save changes.
formBinder.SaveChanges();
}
Now, from the WCF you need to append "batch/" before your url tempalte. So, if your grid data keys looks like:
<sitefinity:RadTreeViewBinder id="sectionTreeBinder" runat="server"
ServiceUrl="~/Sitefinity/Services/Configuration/MyService.svc"
TargetId="sectionTree"
OnClientBinderInitialized="TreeBinderInitialized"
DataKeyNames="nodeId"
....
Your batch method in the WCF service will look like:
[WebHelp(Comment =
"Saves the config section as a batch."
)]
[WebInvoke(Method =
"PUT"
, UriTemplate =
"batch/{nodeId=null}/?provider={provider}"
, ResponseFormat = WebMessageFormat.Json)]
[OperationContract]
public
bool
SaveBatchConfigSection(
string
[][] propertyBag,
nodeId,
provider)
{
Here, the property bag will contain the value of data members defined in the rad grid binder in a sequential way, starting from the first item and all the way to last.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important