【问题标题】:Implementing a loop for each selected item in multi-listbox为多列表框中的每个选定项目实现一个循环
【发布时间】:2017-02-21 17:10:53
【问题描述】:

我正在尝试为多列表框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"];
    }
}

【问题讨论】:

    标签: c# sql vb.net loops listbox


    【解决方案1】:
    foreach (ListBoxItem item in UserProfileTrainingSearch.SelectedItems)
    {
       // your code here
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-07
      • 1970-01-01
      • 2011-06-19
      • 2018-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-24
      相关资源
      最近更新 更多