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

here's the code

    using (SPSite site = new SPSite(""))
        using (SPWeb web = site.OpenWeb())
            SPList SourceList = web.Lists["Record1"];
            SPList TargetList = web.Lists["Record2"];

            SourceList.Fields.AddLookup("Certificate", TargetList.ID, false);
            SPFieldLookup lkp = (SPFieldLookup)SourceList.Fields["Certificate"];

            lkp.LookupField = TargetList.Fields["Name"].InternalName;

            for (int i = 0; i < 3; i++)
                SPView view = SourceList.Views[i];

what I am doing here is creating a lookup field in a already created Sharepoint list, Problem is, when I add a to Source List, it shows me all the certificates in a drop down choice, but when i see all the items view, it shows certificate names as " 1_.000" and increment by the number of items i add to the list, even if i use same certificate.

sounds like a logical problem to me :/

share|improve this question
up vote 0 down vote accepted

The Reason was because, both Sharepoint builtin Forms were calling different attributes of the lookup field.

In order to finish my task, i created a event handler that, copies name field to Title field, so that later on i can use it.

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.