Thursday, November 12, 2009

Linq Bind grid

private void BindGrid()
{
var memberYearDetail = (from MY in Common.dataContext.MemberYears
join PM in Common.dataContext.ProfileMasters
on MY.ProfileId equals PM.ProfileId

join AD in Common.dataContext.AddressDetails
on PM.ProfileId equals AD.LinkedSourceId

join GM in Common.dataContext.GeographyMasters
on AD.GeographicId equals GM.GeographicId
select new
{
MY.ProfileId,
GM.GeographicName,
MemberName = PM.FirstName + " " + PM.MiddleName + " " + PM.LastName
}).Distinct();

grdMemberYear.DataSource = memberYearDetail;
grdMemberYear.DataBind();
}

No comments:

Post a Comment