我正在努力Asp.Net Dynamic Data project with linq to sql。
我创建了一个数据库,该数据库one to one relationship在使用外键指定的两个表之间。
即我有一张桌子Employee和桌子Department
Employee table
empid empname address departmentId 
Department table
departmentId departmentname
现在Student表需要departmentId一个foreign key
当我导航到它时/Insert.aspx,它会department_name在下拉列表中显示一个列表。
它这样做 - 但它显示了所有department_name进入下拉列表
我如何以及在哪里可以编写 linq 查询,以便我可以自定义那些 department_name 值
如果假设我只想computers在该下拉列表中填充为部门名称,我怎么能做到这一点?
代码:在 FieldTemplate 文件夹中ForeignKey_Edit.ascx.cs
protected void Page_Load(object sender, EventArgs e)
    {
        if (DropDownList1.Items.Count == 0)
        {
            if (Mode == DataBoundControlMode.Insert || !Column.IsRequired)
            {
                DropDownList1.Items.Add(new ListItem("[Not Set]", ""));
            }
            PopulateListControl(DropDownList1);
        }
        SetUpValidator(RequiredFieldValidator1);
        SetUpValidator(DynamicValidator1);
    }
数据动态正在内部填充下拉列表。
在此声明之前或之后PopulateListControl(DropDownList1);
我应该编码什么,以便我只能填充特定的值..?