Reputation: 43
I have a list of application which I first filter by those who have paid:
var boapApplicants = _BOAPRepository.GetBOAPApplicantsList_Paid();
It then takes that list and puts it into a new selection of checkbox items so that the user can check off those who need further action:
IList<SelectionCheckBoxItem> selectionCheckBoxItems = new List<SelectionCheckBoxItem>();
selectionCheckBoxItems = GetSelectionCheckBoxItemsList(boapApplicants, selectionCheckBoxItems.ToList());
The top lines of GetSelectionCheckBoxItemsList
look like this:
private List<SelectionCheckBoxItem> GetSelectionCheckBoxItemsList(IList<BOAPApplicant> boapApplicants, List<SelectionCheckBoxItem> selectioncheckBoxItems)
{
foreach (var applicant in boapApplicants)
{
selectioncheckBoxItems.Add(
This returns than placed in a virtual model which has CheckBoxItemsPagedList
defined as:
public IPagedList<SelectionCheckBoxItem> CheckBoxItemsPagedList { get; set; }
The final part is to take the list and checkboxitems and place them in the virtual models PagedList
:
var pageNumber = page == null || page <= 0 ? 1 : page.Value;
var pageSize = 20;
vm.CheckBoxItemsPagedList = new PagedList<BOAPApplicant>(selectionCheckBoxItems, pageNumber, pageSize);
However, I'm getting the error
Cannot convert from 'System.Collections.Generic.IList<DataDesigns.Models.SelectionCheckBoxItem>' to 'System.Linq.IQueryable<DataDesigns.Data.BOAPApplicant>'
on this last line of code.
The PagedList
and SelectionCheckBoxItem
work in other area of the website but not when I've tried to combine the two. I've tried various combinations of List
, Queryable
, Enumerable
, but nothing seems to work.
Upvotes: 0
Views: 54