我在 List newlst = lst.SelectedItems.Cast().ToList()** 上收到错误它说无法将“DevExpress.Web.ASPxEditors.ListEditItem”类型的对象转换为“System.Web.UI.WebControls.ListItem”这是我的代码:
int id = Request.QueryString["id"].ToInt();
ASPxDropDownEdit dde = (ASPxDropDownEdit)FormViewProjectBasicInfo.FindControl("ASPxDropDownEdit1");
ASPxListBox lst = (ASPxListBox)dde.FindControl("listBox");
List<ListItem> newlst = lst.SelectedItems.Cast<ListItem>().ToList();
List<ProjectDependency> dp = DataContext.ProjectDependencies.Where(m => m.MasterProjectID == id).ToList();
for (int i = 0; i < newlst.Count; i++)
{
bool found = false;
for (int j = 0; j < dp.Count; j++)
{
if (dp[j].DependentProjectID==newlst[i].Value.ToInt())
{
break;
}
ProjectDependencyObjectDataSource.InsertParameters["masterprojectid"].DefaultValue =Request.QueryString["id"];
ProjectDependencyObjectDataSource.InsertParameters["dependentprojectid"].DefaultValue =newlst[i].Value;
ProjectDependencyObjectDataSource.Insert();
}
}
请问有什么想法吗?