view - DropDown list issue in knockout js asp.net mvc 3 -
i have following problem. i'm developing web application on asp.net mvc , using knockoutjs in 1 of views. have following viewmodel
public class exampleviewmodel { public ienumerable<element> elementslist { get; set; } } class element { public bool required {get;set;} }
option required must set dropdown list. have following block code in view
<div data-bind="foreach: elementslist"> <select data-bind="attr: { name: 'elementslist[' + $index() + '].required' }, value: required"> <option value="true">yes</option> <option value="false">no</option> </select> </div>
when select yes or no drop down , submit form have appropriate value saved in database, when open view in browser after values in drop down list 'yes'. despite fact when open view , debug can see quick watch, each value elementslist has correct value of required option ('yes' or 'no'), dropdown lists have value 'yes'.
Comments
Post a Comment