Here's the snippet of my view that is giving me error
@model MembershipUserCollection
@{
ViewBag.Title = "Index";
}
@{var usersGrid = new WebGrid(source: Model, rowsPerPage: 40);}
apparently the WebGrid constructor does not accept a MembershipUserCollection as a parameter. How can I get around this?
please help. I need to add pagination to the list of Users.
This should work:
MembershipUserCollection
implements the non-generic interfaceIEnumerable
, whereas the WebGrid constructor parametersource
is a genericIEnumerable<T>
. To convert fromIEnumerable
toIEnumerable<T>
, use theCast
extension method onIEnumerable
.