asp.net mvc - Using @Html.DisplayNameFor() with PagedList -
i've been trying out pagedlist bundle paging index views. going well, , @ controller level working fine, displays 5 records per page, , displays appropriate page based on querystring.
my problem in view. changed @model pagedlist.ipagedlist
access model.hasnextpage
, other properties, @html.displaynamefor(model => model.itemname)
no longer working. error:
pagedlist.ipagedlist<dossier.models.item>' not contain definition 'itemname' , no extension method 'itemname' accepting first argument of type 'pagedlist.ipagedlist<dossier.models.item>' found (are missing using directive or assembly reference?)
here relevant parts of view:
@model pagedlist.ipagedlist<dossier.models.item> @using dossier.models.item ... <th> @html.displaynamefor(model => model.itemname) </th>
it seems ipagedlist not compatible displaynamefor(). thought why happening, , how prepare it? know manually come in column names, i'd info remain (and changeable) in model later.
you can seek this
@html.displaynamefor(model => model.first().itemname)
asp.net-mvc entity-framework razor asp.net-mvc-4 pagedlist
No comments:
Post a Comment