Strange typecasting error: System.string -> weekmenu.SimpleTable
Controller
Function Index() As ActionResult
ViewData("ListFrontName") = WeekMenuRepository.ListFrontName()
ViewData("ListLastName") = WeekMenuRepository.ListLastName()
Return View()
End Function
WeekMenuRepository
Public Function ListFrontName() Implements IWeekMenuRepository.ListFrontName
Dim jow = From p In SimpleTable.SimpleTable Select p
Return jow
End Function
View
<% For Each item As SimpleTable In ViewData("ListFrontName")%>
<p><%=item.SimpleName%></p>
<%Next%>
When i run this i get things to work as expected (i get a list of frontnames)
However if i change this in WeekMenuRepository i get an typecasting error, why is this, what am i doing wrong and how can i fix it?
WeekMenuRepository (changed)
=> Added: select p.SimpleName
Public Function ListFrontName() Implements IWeekMenuRepository.ListFrontName
Dim jow = From p In SimpleTable.SimpleTable Select p.SimpleName
Return jow
End Function