No modifications on client side are required for regular data loading. In other cases you should include the connector.js file into your page. To perform any update operations you have to use dhtmlxDataProcessor, which has been already included in both Professional and Standard editions of dhtmlx library.
For data loading you need to point load (or loadXML) method of dhtmlx component to connector file:
myGrid = new dhtmlXGridObject("pObjId"); //... grid configuration commands myGrid.load("myconnector.ashx");
To perform insert/update/delete operations you should add dhtmlxDataProcessor (for more details about dhtmlxDataProcessor see related documentation):
myDP = new dataProcessor("myconnector.ashx"); myDP.init(myGrid);
To start operating with dhtmlxConnector you should do the following:
<%@ WebHandler Language="C#" CodeBehind="gridConnector.ashx.cs" Class="dhtmlxConnector.gridConnector" %> public class gridConnector : dhtmlxRequestHandler { }
public override IdhtmlxConnector CreateConnector(HttpContext context) { return new dhtmlxGridConnector( "BookStore", //table to select from "sales, title, author, price, instore, shipping, bestseller, pub_date", //fields to select "book_id", //primary key column name dhtmlxDatabaseAdapterType.SqlServer2005, //predefined database adapter type ConfigurationManager.ConnectionStrings["SamplesDatabase"].ConnectionString //connection string ); }
Connector takes all necessary parameters like table name or connection string into its constructor. This is all.
Above code must be enough to show data in component and sync update|delete|create operations from the component to the DB.
Server side initialization for other components and DB types