【发布时间】:2014-02-26 12:26:26
【问题描述】:
谁能帮帮我
我在从我的 sql linq 查询中绑定我的下拉列表时遇到问题,似乎存在匿名类型不是静态类型的问题,然后列表没有被填充
请帮忙谢谢
public static void getlocation()
{
DataClasses_AbintegroDataContext dc = new DataClasses_AbintegroDataContext("name = name");
//List<Location> thelocations = new List<Location>();
var locations = new[] { from a in dc.Locations select new { a.name } };
DropDownList ddLocation = new DropDownList();
ddLocation.DataSource = locations;
ddLocation.DataTextField = "Location";
ddLocation.DataValueField = "Location";
}
【问题讨论】: