本文整理汇总了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 );
}
}
示例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);
}
}
示例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;
}
示例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));
}
}
示例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);
}