or
<telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" OnDataBinding="RadGrid1_DataBinding" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand" Skin="Web20" runat="server" GridLines="None" OnItemCreated="RadGrid1_ItemCreated" style="top: 190px; left: 10px; position: absolute;" width="750px" Height="280px" > <MasterTableView EditMode="InPlace" CommandItemDisplay="Top" DataKeyNames="ID" AutoGenerateColumns="true" ShowFooter="True"> <CommandItemTemplate> <div style="padding: 5px 5px;"> <asp:LinkButton ID="btnAddNew" runat="server" CommandName="AddNewRow"> <img style="border:0px;vertical-align:middle;" alt="" src="Images/AddRecord.gif" /> Add New Row </asp:LinkButton> <asp:LinkButton ID="btnSave" runat="server" CommandName="Save"> <img style="border:0px;vertical-align:middle;" alt="" src="Images/save.png" /> Save in Database </asp:LinkButton> </div> </CommandItemTemplate> </MasterTableView> <ClientSettings> <Scrolling AllowScroll="true" ScrollHeight="230" UseStaticHeaders="true" /> </ClientSettings></telerik:RadGrid>protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) { saveDataInDataTable(); switch (e.CommandName) { case "InsertNewRow": { AddNewRowInDataTable(); //saveDataInDataTable(); string script = "setTimeout( function () { selectedCellId='" + e.CommandArgument.ToString() + "'; MoveDown();},100);"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "selectCell", script, true); ViewState["inserted"] = true; } break; case "AddNewRow": { AddNewRowInDataTable(); //saveDataInDataTable(); } break; case "Save": { //saveDataInDataTable(); //UpdateDatabase(); //Session["key"] = 0; //RadAjaxManager1.Alert("The database was successfully updated"); } break; default: break; } } // Add new empty row into DataTable private void AddNewRowInDataTable() { NewRowsCount++; DataRow row = GridSource.NewRow(); row["ChequeID"] = txtChequeID.Text; row["AccountNo"] = ""; row["AccountName"] = ""; row["Amount"] = 0; row["VAT"] = "S"; row["VATAmount"] = 0; GridSource.Rows.Add(row); RadGrid1.Rebind(); }protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridEditableItem && e.Item.IsInEditMode) { TextBox Amount = (e.Item as GridEditableItem)["Amount"].Controls[0] as TextBox; Amount.AutoPostBack = true; Amount.TextChanged += new System.EventHandler(this.Amount_TextChanged); string eventHandler = string.Format("gridTextBoxOnFocus('{0}');", Amount.ClientID); Amount.Attributes.Add("onFocus", eventHandler); TextBox AccountNo = (e.Item as GridEditableItem)["AccountNo"].Controls[0] as TextBox; AccountNo.AutoPostBack = true; AccountNo.TextChanged += new System.EventHandler(this.AccountNo_TextChanged); } }protected void RadGrid1_PreRender(object sender, EventArgs e) { RadGrid1.Attributes.Add("onkeydown", "onKeyDown(this,event);"); int itemsCount = 0; int columnsCount = 0; StringBuilder builder = new StringBuilder(); // Attach the event handlers to the client side events of the TextBoxes. foreach (GridDataItem item in RadGrid1.MasterTableView.Items) { if (item is GridDataItem) { columnsCount = 0; for (int i = 2; i < RadGrid1.MasterTableView.RenderColumns.Length; i++) { GridColumn column = RadGrid1.MasterTableView.RenderColumns[i]; TextBox textBox = (item[column.UniqueName].Controls[0]) as TextBox; if (textBox != null) { textBox.Attributes.Add("ondblclick", "cellDoubleClickFunction('" + textBox.ClientID + "');"); textBox.Attributes.Add("onclick", "cellClick('" + textBox.ClientID + "');"); } if ((i == 2) || (i == 3) || (i == 4)) { textBox.ReadOnly = true; textBox.Attributes.Add("class", "readOnly"); } columnsCount++; } itemsCount++; } } if (RadGrid1.MasterTableView.Items.Count > 0) { RadGrid1.MasterTableView.GetColumn("ID").Visible = false; RadGrid1.MasterTableView.GetColumn("ChequeID").Visible = false; RadGrid1.MasterTableView.GetColumn("CustomerID").Visible = false; } RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "init", "colls = " + columnsCount + ";rows=" + itemsCount + ";", true); }<telerik:RadComboBox ID="drpParentAccount" runat="server" Height="200px" Width="240px" Filter="Contains" EmptyMessage="Choose Parent Account" MarkFirstMatch="true" ChangeTextOnKeyBoardNavigation="false" DataTextField="Account" DataValueField="Account" OnItemDataBound="RadComboBoxParentAccount_ItemDataBound" EnableLoadOnDemand="true" OnItemsRequested="RadComboBoxProduct_ItemsRequested" AutoPostBack="true" DataSourceID="SqlDataSourceParentAccount" style="top: 10px; left: 550px; position: absolute;"> <HeaderTemplate> <table style="width: 240px" cellspacing="0" cellpadding="0"> <tr> <td style="width: 60px;"> Number</td> <td style="width: 180px;"> Namer</td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table style="width: 240px" cellspacing="0" cellpadding="0"> <tr> <td style="width: 60px;"> <%# DataBinder.Eval(Container.DataItem, "Account") %> </td> <td style="width: 180px;"> <%# DataBinder.Eval(Container.DataItem, "AccountName") %> </td> </tr> </table> </ItemTemplate> </telerik:RadComboBox> <telerik:RadGrid ID="RadGrid1" DataSourceID="SessionDataSource1" runat="server" ShowStatusBar="false" AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="False" GridLines="None" ShowFooter="False" Skin="Web20" style="top: 5px; left: 5px; position: absolute;" Width="780px" Height="470px"> <PagerStyle Mode="NumericPages"></PagerStyle> <MasterTableView DataSourceID="SessionDataSource1" DataKeyNames="TOPID" AllowMultiColumnSorting="True" Width="100%" CommandItemDisplay="None" Name="Customers" HierarchyDefaultExpanded="true"> <DetailTables> <telerik:GridTableView DataKeyNames="BOTID" DataSourceID="SessionDataSource2" Width="100%" runat="server" CommandItemDisplay="None" Name="Orders"> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="BOTID" MasterKeyField="TOPID" /> </ParentTableRelation> <Columns> <telerik:GridBoundColumn SortExpression="BOTID" HeaderText="JournalID" HeaderButtonType="TextButton" DataField="BOTID" UniqueName="BOTID" Visible="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn SortExpression="Account" HeaderText="Account" HeaderButtonType="TextButton" DataField="Account" UniqueName="Account"> </telerik:GridBoundColumn> <telerik:GridBoundColumn SortExpression="AccountName" HeaderText="Account Name" HeaderButtonType="TextButton" DataField="AccountName" UniqueName="AccountName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn SortExpression="Debit" HeaderText="Debit" HeaderButtonType="TextButton" DataField="Debit" UniqueName="Debit"> </telerik:GridBoundColumn> <telerik:GridBoundColumn SortExpression="Credit" HeaderText="Credit" HeaderButtonType="TextButton" DataField="Credit" UniqueName="Credit"> </telerik:GridBoundColumn> </Columns> <SortExpressions> <telerik:GridSortExpression FieldName="Account"></telerik:GridSortExpression> </SortExpressions> </telerik:GridTableView> </DetailTables> <Columns> <telerik:GridBoundColumn SortExpression="Date" HeaderText="Date" HeaderButtonType="TextButton" DataField="Date" UniqueName="Date"> </telerik:GridBoundColumn> <telerik:GridBoundColumn SortExpression="TOPID" HeaderText="JournalID" HeaderButtonType="TextButton" DataField="TOPID" UniqueName="TOPID" Visible="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn SortExpression="JournalTitle" HeaderText="Title" HeaderButtonType="TextButton" DataField="JournalTitle" UniqueName="JournalTitle"> </telerik:GridBoundColumn> </Columns> <SortExpressions> <telerik:GridSortExpression FieldName="Date"></telerik:GridSortExpression> </SortExpressions> </MasterTableView></telerik:RadGrid><asp:SqlDataSource ID="SessionDataSource1" ConnectionString="<%$ ConnectionStrings:SASConnectionString %>" ProviderName="System.Data.SqlClient" runat="server" SelectCommand="Select DISTINCT JournalID AS TOPID, Convert(char(10),CreationDate,103) AS [Date], JournalTitle from Journal Where (JournalID Like @drpJournal) AND (Journal.CreationDate >= @DateFrom) AND (Journal.CreationDate <= @DateTo)" > <SelectParameters> <asp:ControlParameter ControlID="drpJournal" Name="drpJournal" PropertyName="SelectedValue" Type="String" /> <asp:ControlParameter ControlID="RadDatePicker1" Name="DateFrom" PropertyName="SelectedDate" Type="DateTime" /> <asp:ControlParameter ControlID="RadDatePicker2" Name="DateTo" PropertyName="SelectedDate" Type="DateTime" /> </SelectParameters></asp:SqlDataSource><asp:SqlDataSource ID="SessionDataSource2" ConnectionString="<%$ ConnectionStrings:SASConnectionString %>" ProviderName="System.Data.SqlClient" runat="server" SelectCommand="Select JournalID AS BOTID, Journal.Account, AccountName, SUM(Debit) AS Debit, SUM(Credit) AS Credit from Journal JOIN Ledger ON Journal.Account = Ledger.Account Where (JournalID Like @drpJournal) AND (Journal.CreationDate >= @DateFrom) AND (Journal.CreationDate <= @DateTo) GROUP BY JournalID, Journal.Account, AccountName" > <SelectParameters> <asp:ControlParameter ControlID="drpJournal" Name="drpJournal" PropertyName="SelectedValue" Type="String" /> <asp:ControlParameter ControlID="RadDatePicker1" Name="DateFrom" PropertyName="SelectedDate" Type="DateTime" /> <asp:ControlParameter ControlID="RadDatePicker2" Name="DateTo" PropertyName="SelectedDate" Type="DateTime" /> </SelectParameters></asp:SqlDataSource>private static void LoadRootNodes(RadTreeView treeView, TreeNodeExpandMode expandMode) { . . . foreach (var row in sdps) { RadTreeNode node = new RadTreeNode { Text = row.FullText, Value = row.id.ToString(), ExpandMode = expandMode }; node.Attributes.Add("IdAsText", row.IdAsText); if (row.ChildrenCount== 0) { node.ExpandMode = TreeNodeExpandMode.ClientSide; } else { //This works because RadTreeNode has a Checkable propery node.Checkable = false; } treeView.Nodes.Add(node); } } [WebMethod] public static RadTreeNodeData[] LoadSdpTreeView(RadTreeNodeData node) { . . . List<RadTreeNodeData> result = new List<RadTreeNodeData>(); foreach (var row in childNodes) { RadTreeNodeData childNode = new RadTreeNodeData { Text = row.FullText, Value = row.id.ToString() }; childNode.Attributes.Add("IdAsText", row.IdAsText); if (row.ChildrenCount > 0) { childNode.ExpandMode = TreeNodeExpandMode.WebService; // This doesnt work because there is no Checkable propery for RadTreeNodeData // childNode.Checkable = false; } result.Add(childNode); } return result.ToArray(); }System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("nl-nl");System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.CreateSpecificCulture("nl-nl");<?xml version="1.0"?><configuration> <appSettings /> <connectionStrings /> <system.web> <compilation debug="true"> <assemblies> <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> </assemblies> </compilation> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows" /> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> <httpHandlers> <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" /> </httpHandlers> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <handlers> <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" /> </handlers> </system.webServer></configuration>