Ejemplo n.º 1
0
        /// <summary>
        /// Triggers the GetAutoCompleteList event.
        /// </summary>
        public virtual void RaiseGetAutoCompleteList(AutoCompleteListEventArgs ea)
        {
            GetAutoCompleteListEventHandler handler = (GetAutoCompleteListEventHandler)Events[getAutoCompleteList];

            if (handler != null)
            {
                handler(GetEventSender(), ea);
            }
        }
Ejemplo n.º 2
0
        public void UpdateDataSource(string autoSearchText)
        {
            //List<string> items = DataAdapter.DataSource as List<string>;
            //RaiseGetAutoCompleteList(new AutoCompleteListEventArgs(autoSearchText, items));
            object dataSource = new object();
            AutoCompleteListEventArgs args = new AutoCompleteListEventArgs(autoSearchText, dataSource);

            RaiseGetAutoCompleteList(args);
            DataAdapter.SetDataSource(args.AutoCompleteList);
        }
Ejemplo n.º 3
0
        private void myLookUpEdit1_Properties_GetAutoCompleteList(object sender, AutoCompleteListEventArgs e)
        {
            try
            {
                string query = e.AutoSearchText;

                //itemBindingSource.DataSource = list;

                //  itemBindingSource.DataSource = db.Items.Local.ToList();

                //DataTable dt = (e.AutoCompleteList as DataView).Table;
                //dt.Clear();
                if (query.Length > 2)
                {
                    DataTable dt = new DataTable();
                    dt.Columns.Add("ID", typeof(int));
                    dt.Columns.Add("Value", typeof(string));

                    var list = (from s in db.Items.Local where s.Name.Contains(query) select s).ToList();


                    foreach (var item in list)
                    {
                        dt.Rows.Add(new object[] { item.ID, item.Name });
                        //e.AutoCompleteList.Add(String.Format("{0}{1}", e.AutoSearchText, RandomString(5, true)));
                    }
                    e.AutoCompleteList = dt;

                    /*
                     * cmbSearch.Properties.PopulateColumns();
                     * cmbSearch.Properties.Columns["ID"].Visible = false;
                     * cmbSearch.Properties.Columns["Name"].Caption = "الصنف";
                     */
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //e.AutoCompleteList = dt;
        }