The requested page is not available for the requested platform. You are viewing the content for Default platform.

ASPxClientComboBox.ClearItems Method

Removes all items from the client combo box editor.

Declaration

ClearItems(): void

Examples

This example demonstrates how ASPxComboBox items can be manipulated on the client side. The ASPxClientComboBox.AddItem method is used to add a new item, which contains the First Name and Last Name text editor's information, to the end of the ASPxComboBox items collection. The ASPxClientComboBox.ClearItems method is used to delete all items from the ASPxComboBox items collection. The complete sample project is available in the DevExpress Code Central database at E1332.

...
        <dxe:ASPxLabel ID="ASPxLabel1" runat="server" Text="First Name">
        </dxe:ASPxLabel>
        <dxe:ASPxTextBox ID="ASPxTextBox1" runat="server" ClientInstanceName="firstName" 
            Width="170px">
        </dxe:ASPxTextBox>
        <br/>
        <dxe:ASPxLabel ID="ASPxLabel2" runat="server" Text="Last Name">
        </dxe:ASPxLabel>
        <dxe:ASPxTextBox ID="ASPxTextBox2" runat="server" ClientInstanceName="lastName" 
            Width="170px">
        </dxe:ASPxTextBox>
        <br/>
        <dxe: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);
            }" />
        </dxe:ASPxButton>
        <br/>
        <dxe:ASPxComboBox ID="ASPxComboBox1" runat="server" 
            ClientInstanceName="comboBox" ValueType="System.String" Width="350px" 
            TextFormatString="{0} {1}">
            <Columns>
                <dxe:ListBoxColumn Caption="First Name" Name="First Name" 
                    ToolTip="First Name" />
                <dxe:ListBoxColumn Caption="Last Name" Name="Last Name" ToolTip="Last Name" />
            </Columns>
        </dxe:ASPxComboBox>
        <br/>
        <dxe:ASPxButton ID="ASPxButton1" runat="server" Text="Clear Items" 
            AutoPostBack="False">
            <ClientSideEvents Click="function(s, e) {
                comboBox.ClearItems();
            }" />
        </dxe:ASPxButton>

...
See Also