In my view I have my model that has a multiselectlist "YogaStyles". I can get the selected items by index with ".SelectedValues" and a list of all the items in the list with ".Items", where each item has a id and a value that shows the name in the list.

How can I match up the selected values with the items so that I can return a string that shows all the selected items in a string ex. "ashtanga, bikram, anazazi"

here is my model and I'm trying to do it in razor syntax

 @{
     var values = Model.YogaStyles.SelectedValues;
     var items = Model.YogaStyles.Items;

  }

Related posts

Recent Viewed