Some notes:
- Note the AjaxPanel
- Carefully copy the grid design
- Note the java script
- Note the 'read only' attribute on some columns
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site1.Master" CodeBehind="Test.aspx.vb" Inherits="TKQuote.Test" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
function CellValueChanged() {
var grid1 = $find("<%=RadGrid1.ClientID%>");
grid1.get_batchEditingManager().saveAllChanges();
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<telerik:RadAjaxPanel runat="server"></telerik:RadAjaxPanel>
<table style="margin:0 auto" border="0">
<tr>
<td><asp:Label runat="server" ID="lblError" CssClass ="Error"></asp:Label></td>
</tr>
<tr>
<td>
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" CssClass="grid" >
<ClientSettings AllowRowsDragDrop="true" AllowKeyboardNavigation="true">
<ClientEvents OnBatchEditCellValueChanged="CellValueChanged" />
</ClientSettings>
<MasterTableView DataKeyNames="QuoteID" AllowSorting="true" EditMode="Batch" >
<BatchEditingSettings SaveAllHierarchyLevels="true" />
<Columns>
<telerik:GridBoundColumn ReadOnly="True" DataField="ProjectDesc" HeaderText="Project Desc" > </telerik:GridBoundColumn>
<telerik:GridBoundColumn ReadOnly="True" DataField="CustomerName" HeaderText="Customer" > </telerik:GridBoundColumn>
<telerik:GridDateTimeColumn ReadOnly="False" DataField="FollowupDate" HeaderText="Followup" DataFormatString="{0:MM/dd}"></telerik:GridDateTimeColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</td>
</tr>
</table>
</asp:Content>
Imports Telerik.Web.UI
Public Class Test
Inherits InheritedPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Private Sub RadGrid1_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
Dim strError As String = ""
Try
RadGrid1.DataSource = SPs.fp_TKQuote_SEL_tasks(App.ConnectionString).getTable
Catch ex As Exception
ErrorHandler.globalErrorHandler(ex, strError, App.AppName, App.UserName, False)
End Try
End Sub
Private Sub RadGrid1_BatchEditCommand(sender As Object, e As GridBatchEditingEventArgs) Handles RadGrid1.BatchEditCommand
Dim strError As String = ""
Try
For Each command As GridBatchEditingCommand In e.Commands
Dim strTaskText As String
Dim newValues As Hashtable = command.NewValues
'' Access the new values
Dim RowID As Int32 = newValues("RowID")
strTaskText = newValues("TaskText")
' Logic to Save the new values into the database
Next
Catch ex As Exception
ErrorHandler.globalErrorHandler(ex, strError, App.AppName, App.UserName, False)
End Try
End Sub
End Class