samedi 18 avril 2015

Dropdownlist get the selected value in mvc


Vote count:

0




I have a bug which my dropdownlist auto reset value to default! Can u help me! Thanks!


In model, i define: public List StatesId { get; set; }


In view:


A: @Html.DropDownListFor(m => m.StatesId, new SelectList(Model.States.Where(p=>p.StateTypeId == s1), "StateId", "StateContent"), "Select")


B: @Html.DropDownListFor(m => m.StatesId, new SelectList(Model.States.Where(p => p.StateTypeId == s2), "StateId", "StateContent"), "Select")


C: @Html.DropDownListFor(m => m.StatesId, new SelectList(Model.States.Where(p => p.StateTypeId == s3), "StateId", "StateContent"), "Select")


After click submit thì the selected value in A is shown, but the value in B, C box, it will be auto reseted to default which is "select", now, i want to after summit, the value in B and C box will show the value which i have choosen! Thanks



asked 56 secs ago







Dropdownlist get the selected value in mvc

Aucun commentaire:

Enregistrer un commentaire