<legend id='5RpMl'><style id='5RpMl'><dir id='5RpMl'><q id='5RpMl'></q></dir></style></legend>

    1. <i id='5RpMl'><tr id='5RpMl'><dt id='5RpMl'><q id='5RpMl'><span id='5RpMl'><b id='5RpMl'><form id='5RpMl'><ins id='5RpMl'></ins><ul id='5RpMl'></ul><sub id='5RpMl'></sub></form><legend id='5RpMl'></legend><bdo id='5RpMl'><pre id='5RpMl'><center id='5RpMl'></center></pre></bdo></b><th id='5RpMl'></th></span></q></dt></tr></i><div id='5RpMl'><tfoot id='5RpMl'></tfoot><dl id='5RpMl'><fieldset id='5RpMl'></fieldset></dl></div>
      <tfoot id='5RpMl'></tfoot>

      <small id='5RpMl'></small><noframes id='5RpMl'>

        <bdo id='5RpMl'></bdo><ul id='5RpMl'></ul>

        从 asp.net ListBox 中获取所有选定的项目

        时间:2023-10-07

              • <bdo id='R6d0h'></bdo><ul id='R6d0h'></ul>

                <tfoot id='R6d0h'></tfoot>
              • <small id='R6d0h'></small><noframes id='R6d0h'>

                  <tbody id='R6d0h'></tbody>

                <legend id='R6d0h'><style id='R6d0h'><dir id='R6d0h'><q id='R6d0h'></q></dir></style></legend>

                  <i id='R6d0h'><tr id='R6d0h'><dt id='R6d0h'><q id='R6d0h'><span id='R6d0h'><b id='R6d0h'><form id='R6d0h'><ins id='R6d0h'></ins><ul id='R6d0h'></ul><sub id='R6d0h'></sub></form><legend id='R6d0h'></legend><bdo id='R6d0h'><pre id='R6d0h'><center id='R6d0h'></center></pre></bdo></b><th id='R6d0h'></th></span></q></dt></tr></i><div id='R6d0h'><tfoot id='R6d0h'></tfoot><dl id='R6d0h'><fieldset id='R6d0h'></fieldset></dl></div>
                  本文介绍了从 asp.net ListBox 中获取所有选定的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  任何人都知道使用扩展方法获取列表框控件中所有选定项的流畅方法吗?

                  Anyone know of a smooth way to get all of the selected items in a listbox control by using extension methods?

                  并且,请不要让我争论 它与如何获得这样的列表无关,因为最终一切都使用循环来迭代项目并找到选定的项目.

                  And, please, spare me the argument of it's irrelevant as to how one gets such a list because in the end everything uses a loop to iterate over the items and find the selected ones anyway.

                  推荐答案

                  var selected = yourListBox.Items.GetSelectedItems();
                  //var selected = yourDropDownList.Items.GetSelectedItems();
                  //var selected = yourCheckBoxList.Items.GetSelectedItems();
                  //var selected = yourRadioButtonList.Items.GetSelectedItems();
                  
                  public static class Extensions
                  {
                      public static IEnumerable<ListItem> GetSelectedItems(
                             this ListItemCollection items)
                      {
                          return items.OfType<ListItem>().Where(item => item.Selected);
                      }
                  }
                  

                  这篇关于从 asp.net ListBox 中获取所有选定的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何将项目添加到 ListBox 中列表的开头? 下一篇:如何将 DataTable.Select() 的结果绑定到 ListBox 控件?

                  相关文章

                  <small id='iwYTt'></small><noframes id='iwYTt'>

                • <i id='iwYTt'><tr id='iwYTt'><dt id='iwYTt'><q id='iwYTt'><span id='iwYTt'><b id='iwYTt'><form id='iwYTt'><ins id='iwYTt'></ins><ul id='iwYTt'></ul><sub id='iwYTt'></sub></form><legend id='iwYTt'></legend><bdo id='iwYTt'><pre id='iwYTt'><center id='iwYTt'></center></pre></bdo></b><th id='iwYTt'></th></span></q></dt></tr></i><div id='iwYTt'><tfoot id='iwYTt'></tfoot><dl id='iwYTt'><fieldset id='iwYTt'></fieldset></dl></div>
                    <bdo id='iwYTt'></bdo><ul id='iwYTt'></ul>
                    1. <tfoot id='iwYTt'></tfoot>

                    2. <legend id='iwYTt'><style id='iwYTt'><dir id='iwYTt'><q id='iwYTt'></q></dir></style></legend>