Selected Item not being updated?
Posted
by iTayb
on Stack Overflow
See other posts from Stack Overflow
or by iTayb
Published on 2010-03-25T16:55:19Z
Indexed on
2010/03/25
17:03 UTC
Read the original article
Hit count: 334
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.
© Stack Overflow or respective owner