asp.net mvc - ListBox not Selected the Correct Value -


i have listbox display list of description. user supposed selected description , post. worked fine if id between 1 , 9. however, if id 10 , above, getting confusing. example, selected 11th item (starting 0), item 1 , 2 selected instead of 11th item. doing wrong here?

here sample of model , listbox:

@html.listboxfor(m =>m.selectedvalues, new multiselectlist(model.currvalues, "id", "description", model.selectedvalues), new { style = "width:98%; height:300px; clear:both; float:left; color: inherit;", onchange = "changeidentified();", id = "selectedvalues" })   public class currentusers {   public string selectedvalues {get;set;}   public ienumerable<values> currvalues = new list<values>         {             new values { id=0, description=""}         };   [serializable]         public class values         {             public int id { get; set; }             public string description { get; set; }         }  } 

i have web service returning object of type currvalue.

//calling way. currvalues = getvaluefromwebservice(); 

i changed line of code below. worked after making change.

public string selectedvalues {get;set;}   public list<int> selectedvalues {get;set;} 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -