public void LoadItems <T>(IList <T> collection)
        {
            int maxdispcount = 0;

            if (collection == null || this.ItemIDField.Trim().Length == 0)
            {
                return;
            }

            m_dataSource = SelectableItem.Load <T>(collection, this.ItemIDField, this.ItemParentIDField, this.ItemTextField, this.ItemImageField, this.ItemActionField, this.ItemChildField, this.ItemArgsField);
            m_level      = 0;
            if (m_dataSource.ContainsKey(m_level))
            {
                m_levelSource = m_dataSource[m_level];

                m_pageindex  = 0;
                maxdispcount = (this.RowCount * this.ColumnCount);
                m_pagecount  = (collection.Count / maxdispcount) + (collection.Count % maxdispcount > 0 ? 1 : 0);
                PopulateItems(false);
                btnUp.Enabled   = false;
                btnDown.Enabled = (m_pagecount > 1);
            }
            else
            {
                ClearItems();
                btnUp.Enabled = btnDown.Enabled = false;
                lblPager.Text = string.Format("{0}/{1}", m_pagecount == 0 ? 0 : m_pageindex + 1, m_pagecount);
            }
        }
        public void ReloadItems <T>(IList <T> collection, bool isFirstOrder)
        {
            int maxdispcount = 0;

            if (collection == null || this.ItemIDField.Trim().Length == 0)
            {
                return;
            }

            if (isFirstOrder)
            {
                int count = 0;
                T   objToRemove;
                foreach (T item in collection)
                {
                    Type type = collection[count].GetType();
                    // object obj = collection[count];

                    System.Reflection.PropertyInfo pi = type.GetProperty("Code");   //("KIT-PRODUC")
                    object codeVal = pi.GetValue(collection[count], null);

                    if (codeVal.ToString() == "KIT-PRODUC")
                    {
                        objToRemove = item;
                        break;
                    }
                    count++;
                }
                collection.Remove(collection[count]);
            }

            m_dataSource = SelectableItem.Load <T>(collection, this.ItemIDField, this.ItemParentIDField, this.ItemTextField, this.ItemImageField, this.ItemActionField, this.ItemChildField, this.ItemArgsField);
            m_level      = 0;
            if (m_dataSource.ContainsKey(m_level))
            {
                m_levelSource = m_dataSource[m_level];

                m_pageindex  = 0;
                maxdispcount = (this.RowCount * this.ColumnCount);
                m_pagecount  = (collection.Count / maxdispcount) + (collection.Count % maxdispcount > 0 ? 1 : 0);
                PopulateItems(false);
                btnUp.Enabled   = false;
                btnDown.Enabled = (m_pagecount > 1);
            }
            else
            {
                ClearItems();
                btnUp.Enabled = btnDown.Enabled = false;
                lblPager.Text = string.Format("{0}/{1}", m_pagecount == 0 ? 0 : m_pageindex + 1, m_pagecount);
            }
        }