Select multiple value in DropDownList using ASP.NET and C#

后端 未结 4 1493
南方客
南方客 2020-12-06 09:16

Select multiple value in DropDownList using ASP.NET and C#. I tried it to select single value from drop down but unable to find multiple selection.

4条回答
  •  囚心锁ツ
    2020-12-06 09:46

    Take a look at the ListBox control to allow multi-select.

    
                
                
                
     
    

    in the code behind

    foreach(ListItem listItem in lblMultiSelect.Items)
        {
           if (listItem.Selected)
           {
              var val = listItem.Value;
              var txt = listItem.Text; 
           }
        }
    

提交回复
热议问题