none
MVC Dropdownlist with single item only

    Question

  • I have a dropdown list in mvc project. In Jquery i have some code on 'Change' event to populate model further with details. Which works fine. Now the requirement is when there is just one item in the select list, then that should be pre selected when the view is rendered instead of default 'Please Select'. Now what code should i write so that code written in the jquery change event still execute since on change event wont execute now.

    I have already tried pre populating the model if there is only single item but thats too much redundant code. So i want to use same jquery function.

    Thanks


    Monday, July 9, 2018 7:40 PM