List newlst = lst.SelectedItems.Cast().ToList()** でエラーが発生しますここに私のコードがあります:
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();
}
}
何かアイデアはありますか?