I am attempting to filter the items populated in a grid in the code behind. When I try to call my adapter from the data access layer, I am receiving the following error:
Cannot create an instance of the static class 'SFTIP.DataAccessLayer.InventoryAdapter'
The filter is meant to only display items in the grid related to the user role (AssetOwnershipProgramIds
).
The error is in this segment new InventoryAdapter()
of this line:
filteredList = new InventoryAdapter().GetAllByFilter(inventoryFilter);
Here is the code for the filter I am trying to build:
public List<Inventory> BindGrid()
{
List<Inventory> filteredList = new List<Inventory>();
SearchFilterInventory inventoryFilter = new SearchFilterInventory();
User currentUser;
currentUser = (Session["CurrentUser"] == null) ? (User)Session["CurrentUser"] : new User();
if (currentUser.AdminPrograms.Count > 0)
{
inventoryFilter.AssetOwnershipProgramIds.Add(currentUser.AdminPrograms[0].ReferenceId);
filteredList = new InventoryAdapter().GetAllByFilter(inventoryFilter);
}
return filteredList;
}
Can anyone provide some guidance on to where I am going wrong? I know that this is something fairly simple - this is an inherited project and I'm still trying to connect all the dots. Thank you for taking a look.