This example demonstrates how to create a multi-column combo box editor and populate it with items on the client.
Create a combo box editor and populate it with columns.
<dx:ASPxComboBox ID="ASPxComboBox1" runat="server"
ClientInstanceName="comboBox" ValueType="System.String" Width="350px" TextFormatString="{0} {1}">
<Columns>
<dx:ListBoxColumn Caption="First Name" Name="First Name" ToolTip="First Name" />
<dx:ListBoxColumn Caption="Last Name" Name="Last Name" ToolTip="Last Name" />
</Columns>
</dx:ASPxComboBox>
Add a text editor and a button to the page. In the button's client-side Click
event handler, call the combo box editor's AddItems method to add an item to the editor's item collection based on the text editor's value. To remove all items from the collection, call the editor's ClearItems method.
<dx:ASPxTextBox ID="ASPxTextBox1" runat="server" ClientInstanceName="firstName" Width="170px" />
<dx:ASPxTextBox ID="ASPxTextBox2" runat="server" ClientInstanceName="lastName" Width="170px" />
<dx:ASPxButton ID="ASPxButton2" runat="server" Text="Add " AutoPostBack="False">
<ClientSideEvents Click="function(s, e) {
var fName=firstName.GetValue();
var lName=lastName.GetValue();
firstName.SetText('');
lastName.SetText('');
var FullName = new Array(fName,lName);
comboBox.AddItem(FullName);
}" />
</dx:ASPxButton>
<dx:ASPxButton ID="ASPxButton1" runat="server" Text="Clear Items" AutoPostBack="False">
<ClientSideEvents Click="function(s, e) {
comboBox.ClearItems();
}" />
</dx:ASPxButton>
- Default.aspx (VB: Default.aspx)
(you will be redirected to DevExpress.com to submit your response)