我正在使用国家 DDL 中的文本填写州 DDL
foreach (var VARIABLE in ProfileMasterDAL.bindcountry())
{
if (VARIABLE.ToString().Contains(DropDownList1.SelectedItem.Text))
{
var query = from row in ProfileMasterDAL.bindstate().ToString()
where
ProfileMasterDAL.bindstate().ToString().Contains(DropDownList1.SelectedItem.Text)
select row;
DropDownList2.DataSource = query;
DropDownList2.DataBind();
}
}
但在查询中,我得到枚举没有产生任何结果,并且状态 DDL 为空。
public static IEnumerable bindstate()
{
var states = from b in getdata().Descendants("state").SelectMany(state => state.Elements("text"))
orderby (string) b
select (string) b;
return states;
}