Multiple Select Telerik RadComboBox in Code Behind

Telerik have a great demo for a combobox that has checkboxes to enable multiple selection.

Great! Except again, how do you do this in code behind?

First, check out my post about defining multiple columns in a RadComboCox:

Just add a checkbox into the row with your other items. You just change the InstantiateIn method to:

        /// <summary>
        /// Create the template
        /// </summary>
        /// <param name="container"></param>
        public void InstantiateIn(System.Web.UI.Control container)
            PlaceHolder ph = new PlaceHolder();
            CheckBox checkBox = new CheckBox();
            Label item1 = new Label();
            Label item2 = new Label();
            Label item3 = new Label();

            checkBox.ID = "checkBox";
            item1.ID = "item1";
            item2.ID = "item2";
            item3.ID = "item3";

            switch (templateType)
                case ListItemType.Header:
                    ph.Controls.Add(new LiteralControl("<ul><li class='colCheckBox'>Select</li><li class='col1'>Code</li><li class='col2'>Description</li><li class='col3'>Type</li></ul>"));
                case ListItemType.Item:
                    ph.Controls.Add(new LiteralControl("<ul><li class='colCheckBox'>"));
                    ph.Controls.Add(new LiteralControl("</li><li class='col1'>"));
                    ph.Controls.Add(new LiteralControl("</li><li class='col2'>"));
                    ph.Controls.Add(new LiteralControl("</li><li class='col3'>"));
                    ph.Controls.Add(new LiteralControl("</li></ul>"));
                    ph.DataBinding += new EventHandler(Item_DataBinding);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 31 other followers

%d bloggers like this: