ASP.NET中ListBox多选模式时获取其选中项

 

ListBox多选模式(SelectionMode=Multiple)的使用--星烛网

把ListBox的属性设为:SelectionMode=Multiple
可以实现ListBox的多选功能.

要获取这些选中的ListItem,在WinForm下轻而易举!

this .lst_AXzhz.SelectedItems;


但在ASP.NET下却要麻烦一些!(也可通过脚本实现.麻烦,只用在不进行PostBack的情况下,就不说了.)

            ListItemCollection items  =   new  ListItemCollection();
            
foreach  (ListItem item  in   this .lst_AXzhz.Items)
            
{
                
if (item.Selected)
                
{
                    items.Add(item);
                }

            }

你可能感兴趣的:(有关程序,asp.net,postback,winform,脚本)