2016-10-12 6 views
0

Я пытаюсь реализовать foreach цикл для каждого выбранного элемента в нескольких ListBox UserProfileTrainingSearch:Реализация цикла для каждого выбранного элемента в нескольких ListBox

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"]; 
    } 
} 

ответ

0
foreach (ListBoxItem item in UserProfileTrainingSearch.SelectedItems) 
{ 
    // your code here 
} 
Смежные вопросы