【发布时间】:2012-08-25 06:40:43
【问题描述】:
我正在使用国家 DDL 填充州 DDL
public static IEnumerable bindcountry()
{
var countries = from c in getdata().Descendants(("country"))
orderby (string)c.Element("name")
select (string)c.Element("name");
return countries;
}
public List<string> GetStatesByCountry(string CountryName)
{
var query = from user in getdata().Descendants("country")
where user.Element("name").Value == CountryName
from t in user.Descendants("text")
select t.Value;
return query.ToList();
}
foreach (var VARIABLE in ProfileMasterDAL.bindcountry())
{
if (VARIABLE.ToString().Contains(DropDownList1.SelectedItem.Text))
{
var query = from row in ProfileMasterDAL.bindcountry()
where row.(ProfileMasterDAL.GetStatesByCountrys(DropDownList1.SelectedItem.Text))
select row;
DropDownList2.DataSource = query;
DropDownList2.DataBind();
}
}
问题是我无法定义 WHERE 子句和 equals 在这里我得到一个错误:
找不到源类型的查询模式的实现 'System.Collections.IEnumerable'。 '哪里' 没有找到。考虑 显式指定范围变量“行”的类型。
【问题讨论】: