为多列表框中的每个选定项目实现一个循环
本文关键字:实现 项目 循环 一个 列表 | 更新日期: 2023-09-27 18:12:51
我正在尝试为多列表框UserProfileTrainingSearch
:中的每个选定项目实现foreach
循环
if (UserProfileTrainingSearch.SelectedValue != "-1" && //other conditions)
{
foreach (var ListBoxItem in UserProfileTrainingSearch.SelectedValue) // only the first item selected is giving the results.
{
Session["UserbyTrainingType"] = "SELECT DISTINCT USERPROFILE.USER_ISN, USERPROFILE.LAST_NAME + ',' ..........................;
SqlUserProfile.SelectCommand = (string)Session["UserbyTrainingType"];
}
}
foreach (ListBoxItem item in UserProfileTrainingSearch.SelectedItems)
{
// your code here
}