vipin saini

vipin saini

  • NA
  • 88
  • 0

bind gridview from 2 tables using xml linq query

Sep 28 2010 4:51 AM

i have a xml which contain 13 tables , i want to join two tables  .to display 2 tables data in 1 gridview , i am using linq query but it is not working properly the code is below plz  see it and tell me right suggestion.

var employeeinfo = from p in ds2.Tables[11].AsEnumerable()
join c in ds2.Tables[12].AsEnumerable()
on p.Field<int>("TPA_Extensions_Id") equals c.Field<int>("TPA_Extensions_Id") into UP
from c in UP.DefaultIfEmpty()
select new
{
TPA_Extensions_Id = p.Field<
int>("TPA_Extensions_Id"),
BasicPropertyInfo_Id = p.Field<
int>("BasicPropertyInfo_Id"),
RPH = c.Field<
int>("RPH")
};
GridView1.DataSource = employeeinfo;
GridView1.DataBind();

Answers (11)