This is a migrated thread and some comments may be shown as answers.

Selection not persisting

0 Answers 20 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
C
Top achievements
Rank 1
C asked on 16 Jan 2014, 07:33 AM
I have a RadComboBox that gets its data set in the FrameWorkInitialize method like this:

 if (!IsPostBack)
            {
                string firstFilterName = adaptationFilters[0].FilterCategoryName;
                var firstFilterGroup = adaptationFilters[0].FilterCategoryChoices.Select(afc => new ComboBoxItem(firstFilterName, afc)).ToList();
                firstFilterGroup.Insert(0, new ComboBoxItem(firstFilterName, firstFilterName));
                _filterDropDown1.DataSource = firstFilterGroup;
                _filterDropDown1.DataBind();
                _filterDropDown1.SelectedIndex = 0;
}

(where ComboBoxItem is an internal class that has an object, value and a string, text)

Everything looks good until I pick a value. Well, the SelectedIndexChanged event also fires like it should, but after the postback, item 0 is selected again. This happen both with ViewStateMode enabled and without.

What am I doing wrong?

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
C
Top achievements
Rank 1
Share this question
or