Hi,
I would like to know how to limit the number of cols displayed when one clicks the UltraCombo "down" btn.
I bind the ctl to a DataTable, set the DisplayMember property to a col name from the bound table. Then I try to set the DataMember property to a col name from the bound table too, but get an "Object not set to ....blah blah" error.
If I don't set the DataMember property, all works BUT the WHOLE table displays when I select the "down" on the control @ runtime.I only want to display one of the cols.
Can I do that on the UltraCombo AND remain bound to the whole DataTable?
I don't want to use the UltraComboEditor as I don't seem to be able to adjust the width of the list displayed...
Thanks
OK, to add more info to this. do one of the following things:
this.DataMember = sDisplayField; //Where sDisplayField is the field I want displayed in the dropdown this.DataSource = dt; //dt is the DataTable to which I am bindingOR this.SetDataBinding(dt, sDisplayField, false, false);
Neither of the above two scenarios work and I get an "Object reference not set to an instance of an object." ERROR.
However, if I don't assign to the DataMember property, the binding works but I get to see the WHOLE table in the dropdown at run-time.I only want to see ONE named field. And yes, I have checked that the field is named correctly when assigning to the DataMember as I can also assign to DisplayMember without errors.
URGENT, please help!
Would this help you? Columns index is zero based so 0 is column 1, 2 is column 3, etc.
cboUsers.DisplayLayout.Bands[0].Columns[2].Hidden = true;
cboUsers.DisplayLayout.Bands[0].Columns[4].Hidden = true;
cboUsers.DisplayLayout.Bands[0].Columns[6].Hidden = true;
DataMember is not intended to be used to specify a single field. DataMember is only needed when you are binding to a data source that contains multiple tables or list and you want to specify which one to use. Since you are binding to a DataTable, setting DataMember does not make sense and you should leave it null.
If you want to hide certain columns on the list, then you should use the Hidden property on the column. A good place to do this is in the InitializeLayout event.