因此,在此页面中,它将显示当前分包商正在处理此特定 BOQ 的列表。这存储在“allSubContractors”中
这在屏幕上显示为列表。然后我想添加一个下拉框,允许用户选择任何剩余的分包商并将它们添加到列表中。
到目前为止,我已经完成了第一部分的工作,其中列出了在 BOQ 上工作的当前分包商列表,但对于下拉列表,我得到的结果与我想要的完全相反。下拉显示当前分包商的相同列表,我想要列表中的剩余部分。
我正在使用:
`List<string> allSubContractors = new List<string>();
ClarkeDBDataContext db = new ClarkeDBDataContext();
allSubContractors = (from BoqSUBContractors in db.BOQ_SubContractors
where BoqSUBContractors.Bill_Of_Quantity_id == this.boqId
select BoqSUBContractors.Sub_Contractor.Company_Name).ToList();
repeaterShowSubContractorName.DataSource = allSubContractors;
repeaterShowSubContractorName.DataBind();
List<Sub_Contractor> availableSubContractors = new List<Sub_Contractor>();
ClarkeDBDataContext db1 = new ClarkeDBDataContext();
availableSubContractors = (from sc in db1.Sub_Contractors
from bsc in db1.BOQ_SubContractors
where sc.id == bsc.Sub_Contractor_id
&& bsc.Bill_Of_Quantity_id == this.boqId
select sc).ToList();
DropDownListSubContractors.DataSource = availableSubContractors;
DropDownListSubContractors.DataBind();
我正在尝试类似的东西:
List<Sub_Contractor> availableSubContractors = new List<Sub_Contractor>();
availableSubContractors = (from sc in db.Sub_Contractors
select sc.id).ToList()
.Except(allSubContractors);
但是没有快乐,有什么建议吗?塔克斯