Today I study how to refresh content of a DropDownList (based on user selection of content of another DropDownList). It seems quite easy (no need to use AJAX nor UpdatePanel) and let's summarize procedure as below:
1. Define several DropDownList boxes in a web form, remember to define those control as server control (runat="server").
2. Set "AutoPostBack=true" of those DropDownList boxes.
3. Once content of the ListBox is changed, it will trigger functions of "Page_Load()" and "xxxList_SelectedIndexChanged()".
4. Remember to use "if (!Page.IsPostBack) { ... }" to protect the logic in Page_Load( ).
5. Add logic in "xxxList_SelectedIndexChanged" to refresh content of other DropDownList Box.
Wednesday, February 25, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment