<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 中获取所有选定的项目

        Get all selected items from asp.net ListBox(从 asp.net ListBox 中获取所有选定的项目)

              • <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 中获取所有选定的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Populate ListBox with a IEnumrable on another thread (winforms)(在另一个线程(winforms)上使用 IEnumrable 填充 ListBox)
                  listbox selected item give me quot; System.Data.DataRowViewquot; , C# winforms(列表框选择的项目给我quot;System.Data.DataRowView, C# Winforms)
                  Cannot remove items from ListBox(无法从列表框中删除项目)
                  Preventing ListBox scrolling to top when updated(更新时防止列表框滚动到顶部)
                  Deselection on a WPF listbox with extended selection mode(具有扩展选择模式的 WPF 列表框上的取消选择)
                  How do I get at the listbox item#39;s quot;keyquot; in c# winforms app?(如何获取列表框项目的“键?在 c# winforms 应用程序中?)

                  <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>

                            <tbody id='iwYTt'></tbody>
                            <legend id='iwYTt'><style id='iwYTt'><dir id='iwYTt'><q id='iwYTt'></q></dir></style></legend>