public void HandlerSelectUp()
        {
            switch (linkIsSelected)
            {
            case CtrlDropDownListForm.EnumLinkIsSelected.AddNew:
                if (ListingTable.Rows.Count == 0)
                {
                    linkIsSelected = CtrlDropDownListForm.EnumLinkIsSelected.AddNew;
                }
                else
                {
                    int i1 = ListingTable.Rows.Count - 1;
                    SetSelectedRow(i1);
                    linkIsSelected = CtrlDropDownListForm.EnumLinkIsSelected.None;
                }
                break;

            case CtrlDropDownListForm.EnumLinkIsSelected.None:
                int i2 = ListingTable.Rows.Count - 1;
                if (ListingTable.SelectedRows.Count > 0)
                {
                    i2 = ListingTable.SelectedRows[0].Index - 1;
                }
                if (!SetSelectedRow(i2))
                {
                    linkIsSelected = CtrlDropDownListForm.EnumLinkIsSelected.AddNew;
                }
                break;
            }
            UpdateLinkUI();
        }
 public override void UpdateFromText(string text)
 {
     if (String.IsNullOrEmpty(text))
     {
         ListingTable.ClearSelection();
         linkIsSelected = CtrlDropDownListForm.EnumLinkIsSelected.None;
         if (Host != null)
         {
             Host.Value = null;
         }
         return;
     }
     if (linkIsSelected == EnumLinkIsSelected.AddNew)
     {
         ResetDataSource();
     }
     for (int i = 0; i < ListingTable.RowCount; i++)
     {
         string s = DoGetTextFromCacheObject(ListingTable.Rows[i].Tag);
         if (s.StartsWith(text, true, null))
         {
             ListingTable.ClearSelection();
             ListingTable.Rows[i].Selected = true;
             if (ListingTable.Rows[i].Cells["colSelect"].Visible == true)
             {
                 ListingTable.CurrentCell = ListingTable.Rows[i].Cells["colSelect"];
             }
             try
             {
                 ListingTable.FirstDisplayedScrollingRowIndex = i;
             }
             catch (InvalidOperationException)
             {
             }
             linkIsSelected = CtrlDropDownListForm.EnumLinkIsSelected.None;
             return;
         }
     }
     ListingTable.ClearSelection();
     linkIsSelected = CtrlDropDownListForm.EnumLinkIsSelected.None;
     if (Host != null)
     {
         Host.Value = null;
         //Host.Text = null;
     }
 }
        protected override void InitializeFromHost()
        {
            if ((Host == null) || (ListingTable == null))
            {
                return;
            }
            bool flag = ((CtrlDropdownHostList)Host).AllowPicked;

            ListingTable.ClearSelection();
            object nullable = ((CtrlDropdownHostList)Host).Value;

            ListingTable.DefaultCellStyle.Font = Host.TextFont;

            ResetDataSource();
            ListingTable.ClearSelection();
            linkIsSelected = CtrlDropDownListForm.EnumLinkIsSelected.None;
            UpdateLinkUI();
            ReAdjustHeight();
            object obj1 = Host.Value;

            if (obj1 == null)
            {
                return;
            }
            foreach (DataGridViewRow dataGridViewRow1 in ListingTable.Rows)
            {
                if (DoGetIdFromCacheObject(dataGridViewRow1.Tag).Equals(obj1))
                {
                    dataGridViewRow1.Selected = true;
                    try
                    {
                        ListingTable.FirstDisplayedScrollingRowIndex = dataGridViewRow1.Index;
                    }
                    catch (InvalidOperationException)
                    {
                    }
                    return;
                }
            }
        }
 protected void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     linkIsSelected = EnumLinkIsSelected.AddNew;
     HandlerAddNew();
 }