We have Emp (Child list) and Dept (lookup list). Emp list has Dept lookup column pointing to Dept list's Title column.
EmpDataContext dc = new EmpDataContext("http://ramsqlbi:47407/sites/test/");
EntityList<EmpEntity> empList = dc.GetList<EmpEntity>("Emp");
var getName = (from emp in empList
where emp.Dept.Title == "IT"
select emp).First();
string lstrFirstName = getName.Title;
Above code will seek Dept "IT" in Dept list and display First Name from Emp list. Take a look at code "emp.Dept.Title". Emp object has Dept reference which points to Dept list and match Title column in Dept. list. This is the way to query lookup value.
No comments:
Post a Comment