telerik - How to add an additional RadComboBoxItem to data bound RadComboBox? -
i using telerik controls on aspx page. have cascading radcombo boxes(dropdown box). have 3 of them on page. values of 2nd rad combo box depends on 1st , 3rd depends on selection of 2nd. thing want include select option in 3rd dropdown. values coming database i.e of them data bound. how can add 'select all' option in combo boxes? tried using parameters.insert function in c#, not work. tried adding in control not showing either.
can please help?
simple create new radcomboboxitem , add radcombobox. see example below.
radcomboboxitem myitem = new radcomboboxitem(); myitem.text = "select all"; myitem.value = "selectall"; //add last item mycombobox.items.add(myitem); //or /add first item mycombobox.insert(0, myitem);
edit
make sure you're adding item after control has been bound putting our code in databound event of control:
protected void radcombobox1_databound(object sender, eventargs e) { var combo = (radcombobox)sender; combo.items.insert(0, new radcomboboxitem("select all", "selectall")); }
here's documentation telerik explains how properly: http://www.telerik.com/help/aspnet-ajax/combobox-insert-default-item-when-databinding.html.
note: if above method not work, make sure have set mycombobox.appenddatabounditems = true
.
Comments
Post a Comment