Exemplo n.º 1
0
        /// <summary>
        /// Getting All Customer ID From ListBox containing all customers. Author:Pramod
        /// </summary>
        /// <param name="CustomerSelectedListBox"></param>
        /// <returns></returns>
        private string GetAllSelectedCustomerID(DanLudwig.Controls.Web.ListBox CustomerSelectedListBox)
        {
            String AllCustomerId = "";

            // loop through all source items to find selected ones
            for (int i = CustomerSelectedListBox.Items.Count - 1; i >= 0; i--)
            {
                ListItem TempItem = CustomerSelectedListBox.Items[i];
                AllCustomerId = AllCustomerId + "," + TempItem.Value.ToString();
            }
            return(AllCustomerId);
        }
Exemplo n.º 2
0
 public void SelectLastItem(DanLudwig.Controls.Web.ListBox ListBox1)
 {
     for (int i = ListBox1.Items.Count - 1; i >= 0; i--)
     {
         ListItem item = ListBox1.Items[i];
         if (i == ListBox1.Items.Count - 1)
         {
             item.Selected = true;
         }
         else
         {
             item.Selected = false;
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// This will add selected list Items(Customer) From One Lst to Other List. Author:Pramod
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        /// <param name="moveAllItems"></param>

        private void moveSelectedItems(DanLudwig.Controls.Web.ListBox source, DanLudwig.Controls.Web.ListBox target, bool moveAllItems)
        {
            // loop through all source items to find selected ones
            for (int i = source.Items.Count - 1; i >= 0; i--)
            {
                ListItem item = source.Items[i];

                if (moveAllItems)
                {
                    item.Selected = true;
                }

                if (item.Selected)
                {
                    // if the target already contains items, loop through
                    // them to place this new item in correct sorted order
                    if (target.Items.Count > 0)
                    {
                        for (int ii = 0; ii < target.Items.Count; ii++)
                        {
                            if (target.Items[ii].Text.CompareTo(item.Text) > 0)
                            {
                                target.Items.Insert(ii, item);
                                item.Selected = false;
                                break;
                            }
                        }
                    }

                    // if item is still selected, it must be appended
                    if (item.Selected)
                    {
                        target.Items.Add(item);
                        item.Selected = false;
                    }

                    // remove the item from the source list
                    source.Items.Remove(item);
                }
            }
        }