Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'ListTrxn'.


in this line : @Html.ListBox("ListTrxn", Model.lstTrxn, New With {.Class = "textinput", .style = "height:112px;width:164px"})
Posted
Comments
Guruprasad.K.Basavaraju 2-Apr-14 11:25am    
What is Model.lstTrxn ? The second argument must be a list.

1 solution

You will have to use something like below. Just get the right Data item in place of lstTrxn.ID, also if you could post the Model details we can refine this solution

HTML
@Html.ListBox("ListTrxn", Model.Select(item => new SelectListItem { Text = item.lstTrxn.ID.ToString() }), new {@class= "textinput", @style = "height:112px;width:164px"})
 
Share this answer
 
Comments
avelsamy 3-Apr-14 0:09am    
hi guru,

here, instead of item, what i should given to my code
avelsamy 3-Apr-14 0:15am    
also, here i am using .vbhtml file, send me a code related to vbhtml please.

i got the error point locating item..
(Item => new SelectListItem
Guruprasad.K.Basavaraju 3-Apr-14 0:31am    
Samy,
Please give an idea of the model you are working with, paste the model structure. Is it a IEnumerable or a list ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900