Check documentation for the latest version of dhtmlxSuite Combo Specific HowTos DHTMLX Docs

Combo Specific HowTos

How can I populate combo with data from db?

To define options of combo you should use ComboConnector on the server side and specify the connector file in the load() method on the client side:

client side:

var combo=new dhtmlXCombo("combo_zone2","alfa2",200);
combo.load("connector.ashx");

server side:

dhtmlxComboConnector connector = new dhtmlxComboConnector(
    "Categories", //table to select from
    "value_column, label_column", //fields to select 
    "category_id", //primary key column name
    dhtmlxDatabaseAdapterType.SqlServer2005, //predefined database adapter type
    //connection string
    ConfigurationManager.ConnectionStrings["SamplesDatabase"].ConnectionString 
);
  • Names of the fields can have aliases (value or label) to identify the appropriate attribute.
dhtmlxComboConnector connector = new dhtmlxComboConnector(
      "Categories", //table to select from
      "id,firstName AS label", //fields to select 
      ...

Note, in the filtering mode a combo filters data by the "label" field.

Back to top