c# - Get the item option selected in select html from a List<int> of Dictionary -


i have collection (getalldestinationssale) contains values listed in 'select'

@{     var getalldestinationssale = (list<stockdestinationzone>)viewdata["destinationsforsale"]; }  <select id="selectdestination" multiple="multiple">     @foreach (var destinationitem in getalldestinationssale)     {         <option value="@destinationitem.sdtid">             @destinationitem.sdtname         </option>     }  </select> 

and 1 dictionary consists of integer number (id) keys , list (stock ids - sdtid) values

@{     dictionary<int, list<int>> dictdestinations = (dictionary<int, list<int>>)viewdata["associateddestinations"]; } 

now make options in select selected based on ids stored in values of dictionary dictdestinations - means if id stored in list of dictionary equals id (@destinationitem.sdtid) in collection getalldestinationssale, selected.

could guys suggest me idea ? lot


Comments