ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
How can I show the selected values using AjaxCheckboxList?
Title:
B
I
{code}
?
We used AjaxCheckboxList in order to selected some options, and now we want to show the selected and unselected value in our edit view in order to user check or not check values.
Save Changes
Cancel
Juan Equiz
asked at 18 Aug 2015
Answers
B
I
{code}
?
since your using the name "IdAccion" ( Html.Awe().AjaxCheckboxList("IdAccion") ) , you could set ViewData["IdAccion"] = value // e.g. new int[] {1,2,3}; in the action that returns the view or set the value in the view @Html.Awe().AjaxCheckboxList("IdAccion").Value(new int[] {1,2,3}) or use a ViewModel (the most used way, used in our demos), if you look here: http://demo.aspnetawesome.com/GridCrudDemo -> controller tab -> Edit Action, you'll se a model being populated with data and returned to the view so for you it will look something like this: var model = new MyViewModel { IdAccion = some array/collection value ... return View(model); and in the View @model MyViewModel ... @Html.Awe().AjaxCheckboxList(o => o.IdAccion).Url(Url.Action("GetAccionEdit"))...
Save Changes
Cancel
Omu
answered at 18 Aug 2015
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK