Howdy,
I have a grid on a form. I have a combo editor which is variable on the form. I create the instance of the editor in the constructor, set a datasource of the combo editor to a generic list of 3 items, set the value and display members, populate the grid from a SQL procedure then set the EditorComponent of that sell in the init event of the grid.
I get a dropdown in each cell, but no values. I see the datasource of the combo editor has 3 items. Why don't I see any items?
private void ugContractorDoc_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
e.Layout.Bands[0].Columns[docTemplateID"].EditorComponent = ucmboTemplates;
e.Layout.Bands[0].Columns["docTemplateID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
}
//from the constructor
ucmboTemplates = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
ucmboTemplates.DataSource = Document.Template.Controller.ReportTemplateController.GetReportTemplate(tm, false, true);
ucmboTemplates.DisplayMember = "ReportTemplateName";
ucmboTemplates.ValueMember = "ReportTemplateID";
//fill data grid next
Hi,
If you created the UltraComboEditor in code and set it's DataSource, it will not be able to get any data, because it has no BindingSource. You have to either add the UltraComboEditor to the form, or else set it's BindingContext to the BindingContext of the form or a new BindingContext.
I also recommend just adding it to the form's Controls collection - otherwise, it will never get disposed and could create a memory leak.
Thanks a bunch.