In addition to built-in client services, you can also programmatically create your own datasource entirely in the client-side, then bind it to the WebCombo via client API. This mode is called ClientDataSource.
This topic shows how to bind WebCombo to client-side Data Source.
To bind WebCombo to Client-side Data Source
- Select an instance of WebCombo in designer surface.
- Press F4 to bring up the Property Window.
- Set BindingOperationMode to ClientBinding .
- Expand ClientBindingSettings and set DataSourceType property to ClientDataSource.
- Set DataTextField to "Text".
- Set DataValueField to "ID".
- Open WebCombo Designer, select Data Source from the left navigation. Tick the Enable Multiple Columns checkbox.
From the WebCombo Designer, select Columns from the left navigation. Add a column with following detail:
Property Value Name Text BaseFieldName Text HeaderText Item Text
Repeat above step and add another column with following detail:
Property Value Name Desc BaseFieldName Desc HeaderText Item Description Width 120
- Create a function called CreateData(). In the function, there are several things that need to be configured.
First of all, create a DataTable using the following code:
Then, set up the data columns like following:
Next, add the created columns to the data table:
The columns has been set. Now, add rows to the data table like following:
Everything has been configured. Finally, bind the data table to WebCombo.
The CreateData() function has been completed. You can invoke this function using any control, such as using HTML Input Button's OnClick event.