Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
335
UltraComboEditor no items showing despite datasource being valid table
posted

Hi,

I have a grid where I want a column to be a drop down that the user can both select from or type into. When the user types into it then tabs out if the text is not in the list it will open up another form that the user can do a search with in order to add the item to the list. I tried a value list at first but there was no Not in List event so I am trying to use the UltraComboEditor, which I want to look like a normal drop down but have not yet got that far.

I have a project (I tried to include it but it would not let me post a 5.9kb file) where I have an ultragrid on the form, a table is create and bound to the grid in code which is working, then I try to set a columns editor component to an UltraComboEditor but nothing shows in the drop down list, there are items in the table that I am using for the UltraComboEditor so I think they should show in the editor drop down.

My questions are therefore:

1. Why is nothing showing in the drop down

2. How do I get NotInList event to fire?

Thanks

Paul

Code is here, it is just a wondows form project with an ultragrid dropped on the form, nothing changed in the ultragrid from standard

DataTable gridTable;
        public Form1()
        {
            InitializeComponent();
            CreateTableAndBindToGrid();
            SetEntityIDToUltraCombo();
        }

        private void CreateTableAndBindToGrid()
        {
            gridTable = new DataTable();
            gridTable.Columns.Add("EntityID", typeof(int));
            gridTable.Columns.Add("Description", typeof(String));
            this.gridTable.Rows.Add(new object[] { 1, "Paul" } );
            this.gridTable.Rows.Add(new object[] { 2, "John" });
            this.gridTable.Rows.Add(new object[] { 3, "Heidi" });
            this.ultraGrid1.SetDataBinding(this.gridTable, "", true);
        }

        private void SetEntityIDToUltraCombo()
        {
            this.ultraGrid1.DisplayLayout.Bands[0].Columns["EntityID"].EditorComponent = GetUltraComboEditor();
        }

        private UltraComboEditor GetUltraComboEditor()
        {
            DataTable comboTable = new DataTable();
            comboTable.Columns.Add("ID", typeof(int));
            comboTable.Columns.Add("EntityName", typeof(String));
            comboTable.Rows.Add(new object[] { 1, "Paul" });
            comboTable.Rows.Add(new object[] { 2, "John" });
            comboTable.Rows.Add(new object[] { 3, "Heidi" });
            UltraComboEditor editor = new UltraComboEditor();
            editor.DataSource = comboTable;
            editor.ValueMember = "ID";
            editor.DisplayMember = "EntityName";
            editor.DropDownStyle = Infragistics.Win.DropDownStyle.DropDown;
            editor.ItemNotInList += Editor_ItemNotInList;
            
            return editor;
        }

        private void Editor_ItemNotInList(object sender, ValidationErrorEventArgs e)
        {
            throw new NotImplementedException();
        }

Edited: I have since dicsovered the UltraComboEditor has to be added to the forms control collection so I did that (albeit not in the code above) and can see the drop down, still cannot got anything for Not In List though.