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

[Solved] DropDownListFor, with Load on Demand and Default/Selected Item

0 Answers 24 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gene
Top achievements
Rank 1
Gene asked on 23 Jul 2012, 05:57 PM
I want to use a DropDownListFor control that uses Load on Demand that uses Ajax.  This is simple enough.  The issue is, I want to select a default item (e.g. "Please Select" if a value has yet to be selected, or, a text/value pair I have available in my ViewModel) - this seems to be the tricky part.  I am able to easily bind to, and select an added "Please Select" item if an item has yet to be selected, but when when I click the drop down list, my controller action to load the list of other items is not called.  I would also need to reinsert the "Please Select" item after I load (because I do not want to return this from the list of items coming back from the action), as well as select the default or previously selected item after the load (I think I can figure out the 2 latter). Gotta be someone out there that has done this.
Tags
ComboBox
Asked by
Gene
Top achievements
Rank 1
Share this question
or