SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanna join two list and fill drop down list by specific column but i have error in join query note:c.user_id is lookup field

my code

lst.DataSource = (from c in dc.Complainant
                     join u in dc.User_collec
                     on c.User_id equals u.User_id
                     select new { m=u.Title }).ToList();

the Error is The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.

share|improve this question
I think the solution is easy but i need it :( – NOOR Apr 20 '13 at 22:31
There is no solutions !! why :( :( – NOOR Apr 20 '13 at 23:19

If your lookup is not of multi type, something like this is worth a shot:

lst.DataSource = (from SPListItem c in dc.Complainant
    where c["User_id"] != null
    join SPListItem u in dc.User_collec
    on new SPFieldLookupValue(c["User_id"] as string).LookupValue
    equals u.User_id
    select new { m=u.Title }).ToList();

The differens is mainly the extraction of the value from the Lookup column, and that it takes in account cases where the c.User_id is null

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.