当前位置: 首页>>代码示例>>C#>>正文


C# ListBox.GetSelectedIndices方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.ListBox.GetSelectedIndices方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.GetSelectedIndices方法的具体用法?C# ListBox.GetSelectedIndices怎么用?C# ListBox.GetSelectedIndices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.ListBox的用法示例。


在下文中一共展示了ListBox.GetSelectedIndices方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: remove

 protected void remove( ListBox lb )
 {
     int[] selected = lb.GetSelectedIndices();
     foreach( int i in selected )
     {
         lb.Items.RemoveAt( i );
     }
 }
开发者ID:ohri,项目名称:netba_dotnet2,代码行数:8,代码来源:TransactionEditor.aspx.cs

示例2: getValueListBox

        private void getValueListBox(ListBox lb, int videoid, int type)
        {
           
            foreach (int i in lb.GetSelectedIndices())
            {
                VideoModel vm = new VideoModel();
                vm.Video_Insert_Option(videoid, Convert.ToInt32(lb.Items[i].Value), type);
            }

        }
开发者ID:gianglv0212,项目名称:VMC,代码行数:10,代码来源:Add.aspx.cs

示例3: GetSelectedLstBxValues

 /// <summary>
 /// Gets list of all selected items of a listbox
 /// </summary>
 /// <param name="listBox">Listbox control</param>
 /// <returns>Array of selected items</returns>
 private string[] GetSelectedLstBxValues(ListBox listBox)
 {
     int[] arrSelectedIndex = listBox.GetSelectedIndices();
     string[] arrValues = new string[arrSelectedIndex.Length];
     int counter = 0;
     foreach (int index in arrSelectedIndex)
     {
         arrValues[counter] = listBox.Items[index].Text;
         counter++;
     }
     return arrValues;
 }
开发者ID:vijaymca,项目名称:Dotnet,代码行数:17,代码来源:FunctionalityUsageAdvReport.ascx.cs

示例4: getValueListBox

        private void getValueListBox(ListBox lb, int roleID)
        {

            foreach (int i in lb.GetSelectedIndices())
            {
                RoleModel RL = new RoleModel();
                RL.Role_AddLink(roleID, Convert.ToInt32(lb.Items[i].Value));
            }

        }
开发者ID:gianglv0212,项目名称:VMC,代码行数:10,代码来源:Permission.aspx.cs

示例5: MoveListItems

 /// <summary>
 /// Moves spare part items from source list box to destination list box.
 /// </summary>
 /// <param name="srcListBox">Source list box to be specified</param>
 /// <param name="destListBox">Destination list box to be specified</param>
 /// <param name="srcPriceCalculation">True - adds prices of selected spare parts, false - doesn't add prices of selected spare parts</param>
 /// <param name="persister">Persister to be specified</param>
 /// <param name="totalPrice">Stores total price of selected spare parts</param>
 public static void MoveListItems(ListBox srcListBox, ListBox destListBox, 
     bool srcPriceCalculation, ICarServicePersister persister, out decimal totalPrice)
 {
     totalPrice = 0M;
     int[] srcSelectedIndices = srcListBox.GetSelectedIndices();
     ListItemCollection destListItems = destListBox.Items;
     int totalNumberOfDestItems = destListItems.Count + srcSelectedIndices.Length;
     List<int> destItemValues = new List<int>(totalNumberOfDestItems);
     foreach (ListItem item in destListItems)
     {
         CarServiceUtility.AddEntityId(destItemValues, item.Value);
     }
     foreach (int selectedIndex in srcSelectedIndices)
     {
         ListItem item = srcListBox.Items[selectedIndex];
         CarServiceUtility.AddEntityId(destItemValues, item.Value);
     }
     BindSparePartsLists(destItemValues, srcListBox, destListBox, srcPriceCalculation, persister, out totalPrice);
 }
开发者ID:TelerikAcademy,项目名称:QA-Academy,代码行数:27,代码来源:CarServicePresentationUtility.cs


注:本文中的System.Web.UI.WebControls.ListBox.GetSelectedIndices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。