Mvc Populating Drop Down List From Database
Im pretty new to MVC. Im trying to populate a drop downlist with currencies retrieved from database. What am I doing wrong? @model IEnumerable
Solution 1:
The error says it all. You are returning a collection of Currency
as shown by this code
IEnumerable<CommonLayer.Currency> currency
and yet your view expect as a collection of ExchangeRates
@modelIEnumerable<DSABankSolution.Models.ExchangeRates>
so you either change the declaration in your view to
@modelIEnumerable<CommonLayer.Currency>
or return a list of ExchangeRates
from your controller method
Solution 2:
Your view expects a strongly typed model of type
IEnumerable<DSABankSolution.Models.ExchangeRates>
However,you are passing
IEnumerable<CommonLayer.Currency>
back to view.
Post a Comment for "Mvc Populating Drop Down List From Database"