C# 如何显示带有表中列名称的DropDownList

C# 如何显示带有表中列名称的DropDownList,c#,model-view-controller,entity,html.dropdownlistfor,C#,Model View Controller,Entity,Html.dropdownlistfor,早上好 我有一个名为AGG_TREE的表,其中包含以下4列: 列集合、父项代码、系数和创建日期 我所做的:显示一个带有列名称的下拉列表,当我选择一个列的名称时,我会在视图中显示它的数据 这就是我能做的: AGG_TREEEntities db = new AGG_TREEEntities(); var query = (from discs in db.AGG_TREE select ( the names of the column

早上好

我有一个名为AGG_TREE的表,其中包含以下4列:

列集合、父项代码、系数和创建日期

我所做的:显示一个带有列名称的下拉列表,当我选择一个列的名称时,我会在视图中显示它的数据

这就是我能做的:

AGG_TREEEntities db = new AGG_TREEEntities();

        var query = (from discs in db.AGG_TREE

                     select ( the names of the columns ??? ).ToList();

        List<string> nameOfMycolumns = new List<string>();
        foreach (var item in query)
        {
            nameOfMycolumns .Add(item.[the names of the columns ???]);
        }
        ViewBag.NameOfMycolumns  = nameOfMycolumns ;
        return View();
    }

感谢您的帮助

问题到底出在哪里?早上好,我想显示一个包含我的clonnescan名字的下拉列表。您可以提供一些代码并指出您的问题到底是什么?我没有代码,我正在进行编程,我想要一个代码,它显示一个带有表列名的下拉列表,当我选择一个表名时,我会在一个视图中显示它的数据,但你必须至少显示一些工作。。。这里没有人会为您编写代码。