<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StoresGrid.aspx.cs" Inherits="StoresGrid" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<
head
runat
=
"server"
>
<
title
>Stores batch editor with RadGrid client binder</
title
>
</
head
>
<
body
xmlns:sys
=
"javascript:Sys"
xmlns:dataview
=
"javascript:Sys.UI.DataView"
sys:activate
=
"*"
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"scriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Name
=
"MicrosoftAjax.js"
Path
=
"~/Sitefinity/Scripts/MicrosoftAjax.js"
/>
<
asp:ScriptReference
ScriptMode
=
"Inherit"
Path
=
"~/Sitefinity/Scripts/MicrosoftAjaxTemplates.js"
/>
<
asp:ScriptReference
ScriptMode
=
"Inherit"
Path
=
"~/Sitefinity/Scripts/MicrosoftAjaxAdoNet.js"
/>
</
Scripts
>
</
asp:ScriptManager
>
<
input
type
=
"button"
value
=
"Save changes"
onclick
=
"SaveChanges();"
/>
<
br
/>
<
telerik:RadGrid
id
=
"storesGrid"
runat
=
"server"
allowpaging
=
"True"
AllowSorting
=
"true"
PageSize
=
"10"
>
<
MasterTableView
PageSize
=
"10"
>
<
Columns
>
<
telerik:GridClientSelectColumn
></
telerik:GridClientSelectColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Name"
SortExpression
=
"Name"
UniqueName
=
"BinderContainer0"
></
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Description"
SortExpression
=
"Description"
UniqueName
=
"BinderContainer1"
></
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"true"
EnableDragToSelectRows
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
<
sitefinity:RadGridBinder
id
=
"storesBinder"
runat
=
"server"
ServiceUrl
=
"~/Sitefinity/Services/Commerce/Stores.svc"
BindOnLoad
=
"true"
TargetId
=
"storesGrid"
OnClientDataBound
=
"StoresGridDataBound"
DefaultSortExpression
=
"Name"
DataMembers
=
"Id, Name, Description"
DataKeyNames
=
"Id"
>
<
Containers
>
<
sitefinity:BinderContainer
runat
=
"server"
>
<
input
type
=
"text"
name
=
"Name"
sys:value
=
"{{Name}}"
/>
</
sitefinity:BinderContainer
>
<
sitefinity:BinderContainer
runat
=
"server"
>
<
textarea
name
=
"Description"
>{{Description}}</
textarea
>
</
sitefinity:BinderContainer
>
</
Containers
>
</
sitefinity:RadGridBinder
>
<
script
type
=
"text/javascript"
>
function SaveChanges() {
var storesBinder = $find('<%= storesBinder.ClientID %>');
storesBinder.SaveChanges();
}
function StoresGridDataBound(sender, args) {
var storesBinder = $find('<%= storesBinder.ClientID %>');
var keys = storesBinder.get_dataKeys();
}
</
script
>
</
form
>
</
body
>
</
html
>
The sample above was implemented as a standard stand-alone ASP.NET page.
If you inspect the RadGridBinder declaration you will notice that we have placed the HTML input elements in the containers and set their name attributes to the name of the properties they represent: