ASP.NET MVC3 - problem handling multiple values from a strongly typed Listbox -


I'm having trouble handling multiple values ​​from a strongly typed listbox I have an event class that has many technical Classes can be.

Here's my simplified event class:

  Public class event {public id id {get; Set; } Public IEnumerable & lt; Technology & gt; Technologies (Received); Set; }}   

I was using this

  public list & lt; Technology & gt; Technologies (Received); Set; }   

and

 changed to ; Public iyimerable & lt; Technology & gt; Technologies (Received); Set; }   

but still get the same error.

Here is a technical classroom, it is a very simple one.

  Public category technology {Receive Public Entry ID; Set; } Public string description {get; Set; }}   

Here's my simple administrator

  generate public action () {var from TechnologyQry = d by db.Technology order d.Description new {D} .id, d. Description}; ViewBag.eventTechnology = New Multi Sealist (Technology Curie, "ID", "Details"); See Return (); }   

and here is the visual section that provides the list box prefix @ html.ListBoxFor (model = & gt; model.Technologies, (MultiSelectList ViewBag.eventTechnology)

and I'm getting an error of thit

Key 'Technologies' has 'System'. Selection. List 1 1 [[stuff.Models.Technology, content, version = 1.0.0.0, culture = neutral, publicKeyToken = null]] 'but should be' IEnumerable 'type. /

Sorry, English is not my main language, I would appreciate any help I could get thank you.

What model have you defined in viewing the @model ... ?
Besides, the Create method is not returning being used as / model for some if you want a list box called "Technologies" in the name attribute, you can use it instead:

  @html Listbox (see "Technologies", (Multi Selectlist) Bag.EventTechnology)    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -