Friday, April 13, 2012

AppendDataboundItems for ASPxCombobox

In order to mimic the 'AppendDataBound' feature found in normal ASP.NET comboboxes for devexpress and add items to a bound control, you need to use the databound event to insert the new values if you need a server side solution

protected void myComboBox_DataBound(object sender, EventArgs e)
        {
            myComboBox.Items.Add("All", "0").Index = 0;
            myComboBox.SelectedIndex = 0;
        }

You can also do it at client side by using the following code

comboBox.ClientSideEvents.Init = "function(s, e) {s.InsertItem(0, '(ALL)', '');}";





No comments:

Post a Comment