This question is purely academic, because I\'d never dream of doing this in real code.
Using LINQ to SQL, I want to bind an IQueryable
public IQueryable MembershipGetAll()
{
var obj = (from mem in db.GetTable()
select new
{
NAME = mem.MEMBERSHIP.NAME,
TYPE = mem.MEMBERSHIP.TYPE,
TAX_ID = mem.TAX_RATE.TAX_ID,
DISCOUNT = mem.DISCOUNT,
DISCOUNT_PERCENT = mem.DISCOUNT_PERCENT,
}
).AsQueryable();
return obj;
}
private void LoadMembership()
{
IQueryable mem = null;
mem = eb.MembershipGetAll();
grdMembership.DataSource = mem;
grdMembershipRates.DataBind();
}
Just do it like this