Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

How to dynamically connect a site lookup column to a source list?

$
0
0

Hi,

I am creating a SharePoint project via C# and am having problems 'connecting' my site column lookup to a source list. I am declaring these declaratively like so:

<Field Type="Lookup" DisplayName="Invoice Status" Description="Site Column for Status" Required="FALSE" EnforceUniqueValues="FALSE" UnlimitedLengthInDocumentLibrary="FALSE" Group="Custom Columns" ID="{9f44bab3-07ff-4245-8678-cce619b056b9}" StaticName="Status" Name="Status" />
<ListInstance Title="Status" Url="Lists/Status" FeatureId="00bfea71-de22-43b2-a848-c05709900100" TemplateType="100" Description="List for storing possible Status"></ListInstance>

I am connecting my Lookup column into a Site Content Type and I just do a ContentTypeBinding for the List which I am using the lookup column.

The problem I want to solve is I want to 'connect' my Site Lookup Column to my source list in the Feature Event Receiver, specifically the FeatureActivated event. I have tried so far something like:

SPList listStatus = myWeb.Lists["Status"];
SPFieldLookup fieldStatus = myWeb.Fields["Status"];

fieldStatus.LookupList = listStatus.ID.ToString();

To no avail.. Please help! Thanks much!


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>