Rate this demo

Thank you for your post!
Submit a support ticket
If you have an active license or trial, you have access to dedicated support from Telerik’s developers. Response time is 24h for active licenses and 72h for trials, Mon-Fri.
Post in the forums
If you don’t have access to support or would like to help other people by sharing your problem, reach out to our active community in the forums.

ComboBox - Add/Remove/Disable Items

Available actions

RadComboBox provides rich server-side API. It allows the developer to easily add, remove or disable items.

To add an item to the combo, simply create a new RadComboBoxItem instance and add it to the Items collection of the combo, e.g
RadComboBox1.Items.Add( new RadComboBoxItem("Some Item") );

To remove an item, simply call the Remove() method of the item.

To disable an item, just set the Enabled property of the combo to false.
Show code in new window Demo isolation steps
<%@ Page AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="ComboBox.Examples.Programming.AddRemoveDisable.DefaultCS"Language="c#"  %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns=''>
    <title>ASP.NET ComboBox Demo - Add/Remove/Disable Items</title>

    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />

     <div class="qsf-demo-canvas qsf-demo-canvas-vertical">
          <telerik:RadComboBox ID="RadComboBox1" runat="server" Height="140" Width="210" />

     <qsf:ConfiguratorPanel runat="server" ID="ConfigurationPanel1" Title="Available actions"
          Orientation="Vertical" Expanded="true">
                    <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" Text="Native Rendering Mode" />
                    <asp:Button ID="LinkButton1" runat="server" CausesValidation="False"
                         OnClick="LinkButton1_Click" Text="Disable Selected Item" />
                    <asp:Button ID="Linkbutton4" runat="server" CausesValidation="False"
                         OnClick="Linkbutton4_Click" Text="Enable All Items" />
                    <asp:Button ID="LinkButton2" runat="server" CausesValidation="False"
                         OnClick="LinkButton2_Click" Text="Delete Selected Item" />
                    <asp:TextBox runat="server" ID="TextBox1" Width="220" />
                    <asp:Button ID="Linkbutton3" runat="server" OnClick="Linkbutton3_Click"
                         ValidationGroup="AddButton" Text="Add New Item" />
                    <br />
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                         ControlToValidate="TextBox1" ValidationGroup="AddButton"
                         ErrorMessage="Cannot add empty items." Display="Dynamic" />