Tags

, ,

To show multiple SPList data in a grid by below code:

SPList cList = spWeb.Lists.TryGetList(“Customer”);
SPList oList = spWeb.Lists.TryGetList(“Order”);

DataTable cTable = cList.Items.GetDataTable();
DataTable oTable = oList.Items.GetDataTable();

var coList = from tbl1 in cTable.AsEnumerable()
join tbl2 in oTable.AsEnumerable() on tbl1[“Title”] equals
tbl2[“CustomerName”]
select new {
ItemName = tbl2[“Title”],
CustomerName = tbl1[“Title”],
Mobile = tbl1[“MobileNo”]
};

dgvJoinList.DataSource = coList;
dgvJoinList.DataBind();

Advertisements