tags:

views:

46

answers:

1

I have a DropDownList on an ASP.NET master page and I want to change some values and refresh the page when I select a different item from the list. I enabled the post back property in the DropDownList but it still gets back always to the first value whenever I select. Any advice?

+1  A: 

Please post some more code to show where you are setting the value of the dropdown (both on load and anywhere else).

Usually, this is just a case of not understanding the event model. Try setting breakpoints on all of those points where you set the value and step through the code.

The most obvious case would be if you're setting the value in the page_load event handler and not wrapping it in a check for !Page.IsPostback

Tim Hoolihan
protected void ddlFAQ_SelectedIndexChanged1(object sender, EventArgs e) { if (ddlFAQ.SelectedValue == "3") Session["FAQ"] = "3"; if (ddlFAQ.SelectedValue == "4") Session["FAQ"] = "4"; if (ddlFAQ.SelectedValue == "a") Session["FAQ"] = "a"; }
Ahmad Farid
Is there a place where you set the selected item?
Oliver Hanappi
no i dont set the selected item. is there a place where i should do that??
Ahmad Farid