Hi there
I have a class like this:
ChartAccountAllocation allocation = new ChartAccountAllocation(Convert.ToInt64(ViewState["ChartAccountAllocationID"]));
frmvwMainProfileDetail.DataSource = allocation;
There is a bug on the second line and it saying that [System.InvalidOperationException] = {"Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource."}
I am using Page View btw. How do convert this?
Here's the class definition:
public class ChartAccountAllocation : Allocation
{
protected Int64 allocationTypeID;
public ChartAccountAllocation()
{
}
public ChartAccountAllocation(Int64 ID)
{
BrpAllocation entity = new BrpAllocation();
if (entity.LoadByPrimaryKey(ID))
{
id = (Int64)entity.AllocationID;
guid = entity.AllocationGUID.ToString();
allocationTypeID = (Int64)entity.AllocationTypeID;
code = entity.AllocationCode;
name = entity.AllocationName;
description = entity.AllocationDescription;
createdUTCTimeStamp = (DateTime)entity.CreatedUTCTimeStamp;
createdIP = entity.CreatedIP;
createdBy = entity.CreatedBy.ToString();
lastModifiedUTCTimeStamp = (DateTime)entity.LastModifiedUTCTimeStamp;
lastModifiedIP = entity.LastModifiedIP;
lastModifiedBy = entity.LastModifiedBy.ToString();
isActive = (Boolean)entity.IsActive;
item = new ChartAccountAllocationItem();
items = item.Get(id);
}
}
public override List<AllocationItem> Items
{
get { return items; }
set { items = value; }
}
public override Int64 ID
{
get { return id; }
set { id = value; }
}
public override String GUID
{
get { return guid; }
set { guid = value; }
}
...
}
Thanks