To use the functionality of DHTMLX Connector, first you should initialize it.
Generally, both the client side and the server side are concerned in it.
//index.html
myGrid = new dhtmlXGridObject("someContainer");// initializes grid
...
myGrid.load("myconnector.ashx");
1) Specify the connector file in the load method of a component.
2) Initialize dhtmlxDataProcessor on the client side (read more about it here).
//index.html
myGrid = new dhtmlXGridObject("someContainer");// initializes grid
...
myGrid.load("myconnector.ashx");
myDP = new dataProcessor("myconnector.ashx");// initializes dhtmlxDataProcessor
myDP.init(myGrid);
Client side initialization for Tree, TreeGrid, Combo
1) Create ASP.NET Generic Handler, inherited from the dhtmlxRequestHandler class.
<%@ WebHandler Language="C#"
CodeBehind="gridConnector.ashx.cs"
Class="dhtmlxConnector.gridConnector" %>
public class gridConnector : dhtmlxRequestHandler
{
}
2) Override the CreateConnector method. In this method you should create an individual component-related dhtmlxConnector which will interpret the client's requests. In the example below, we create dhtmlxGridConnector to serve the dhtmlxGrid component's requests.
public override IdhtmlxConnector CreateConnector(HttpContext context)
{
return new dhtmlxGridConnector(
"BookStore", //table to select from
//fields to select
"sales, title, author, price, instore, shipping, bestseller, pub_date",
"book_id", //primary key column name
dhtmlxDatabaseAdapterType.SqlServer2005, //predefined database adapter type
//connection string
ConfigurationManager.ConnectionStrings["SamplesDatabase"].ConnectionString
);
}
Connector takes all the necessary parameters, such as a table name or the connection string, into its constructor.
Server-side initialization for other components and DB types
Back to top