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

Linq Query to a Lookup with allow multiple values...

$
0
0

Hi,

I have document library where in I have added on Look up column with allow multiple values.

When I add documents in document library it shows ID as ";" seperated. i.e. 006e0000001uzRKAAY; 006e0000002MnNRAA0

I am quering this document library using linq. I am fetching this ID column in this linq query. Problem is it is giving me Entity Set. Following is my query:

 var documentsList = from documents in ILDMSDataContext.Documents.ScopeToFolder("", true).ToList()
                                        .Where(p => (((DropDownListYear.SelectedIndex == 0) || (p.Year != null && DropDownListYear.SelectedIndex != 0 && p.Year.Id == Convert.ToInt32(DropDownListYear.SelectedValue)))&& ((DropDownListDocumentType.SelectedIndex == 0) || (p.DocumentType != null && DropDownListDocumentType.SelectedIndex != 0 && p.DocumentType.Id == Convert.ToInt32(DropDownListDocumentType.SelectedValue)))&& ((DropDownListContractType.SelectedIndex == 0) || (p.ContractType != null && DropDownListContractType.SelectedIndex != 0 && p.ContractType.Id == Convert.ToInt32(DropDownListContractType.SelectedValue)))&& ((DropDownListAccount.SelectedIndex == 0) || (p.AccountID != null && DropDownListAccount.SelectedIndex != 0 && p.AccountID.Id == Convert.ToInt32(DropDownListAccount.SelectedValue)))&& ((TextBoxAgreementNumber.Text.Trim() == string.Empty) || (!string.IsNullOrEmpty(p.AgreementNumber) && p.AgreementNumber == TextBoxAgreementNumber.Text.Trim()))&& ((TextBoxFileName.Text.Trim() == string.Empty) || (!string.IsNullOrEmpty(p.Title) && p.Title == TextBoxFileName.Text.Trim()))))
                                    join accounts in ILDMSDataContext.Accounts on documents.AccountID.AccountID equals accounts.AccountID
                                    select new { FileName = documents.Title, Name = documents.Name, AccountID = documents.AccountID.AccountID, DocumentID = documents.DocumentID,OpportunityIDs =documents.OpportunityID, DocumentType = documents.DocumentType == null ? string.Empty : documents.DocumentType == null ? string.Empty : documents.DocumentType.Title, ContractType = documents.ContractType == null ? string.Empty : documents.ContractType.Title, Year = documents.Year == null ? string.Empty : documents.Year.Title, AgreementNumber = documents.AgreementNumber, AccountName = accounts == null ? string.Empty : accounts.Title };

OpportunityIDs =documents.OpportunityID this is the column which have Lookup with allow multiple values. Can anybody help me to get value of OpportunityID from Entity Set. Thanks.

Regards,

Amit




Viewing all articles
Browse latest Browse all 11571

Trending Articles



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