I've got the following DropDownList control:
<asp:DropDownList ID="SubjectFilter" runat="server" AutoPostBack="True" onselectedindexchanged="SubjectFilter_SelectedIndexChanged"></asp:DropDownList>
SubjectFilter
data:
BookStore b = new BookStore();
b.LoadFromXML(Server.MapPath("list.xml"));
SubjectFilter.DataSource = b.BooksList.Select(x => x.Subject).Distinct().ToArray();
SubjectFilter.DataBind();
SubjectFilter.Items.Insert(0, new ListItem("הכל", "Default"));
Everything loads just fine. However in the SubjectFilter_SelectedIndexChanged
method, SubjectFilter.SelectedValue
is always Default
, even though I'm selecting different options.
What is the problem? Thank you very much.