I've added an Unbound column to grid for adding combo control in it. I tried to add UltraDropDown/UltraCombo both through code and at design time but it doesn't show in grid. I tried both with EditorComponent and ValueList properties. Although it's not giving any error but it doesn't show up in grid.If I replace this UltraCombo with check box it works perfect both at design and run time.
Hi,
What's the DataType of the unbound column? If you did not set it, it will be string by default.
How are you populating your DropDown/Combo? Are you setting the ValueMember and/or DisplayMember?
When you say "it doesn't show in grid" do you mean that you do not even see a dropdown arrow in the grid cell when you click on the cell? Or do you see the dropdown arrow but are unable to drop it down?
Are you setting any other properties on the unbound column, such as the Style property?
Are you loading a Layout or a Preset or do you have code in the InitializeLayout event or some other event that might be overriding the settings you are applying to the unbound column?
Mike the only mistake was the event.
Actually my task is to show different type of input controls in single column in each row depending on the value of data.
e.g. in bound dataset I have a field named "type" that defines the type of some info and depending on value of type I've to show DatePickers, Checkbox, combo, textbox in single column of grid in each row.
I hope you may have understood my requirement, I don't know is it possible by any solution or by some tweak.
Please suggest me some solution and event that I should use to do this.
Thanks alot for your assistance.
microsoftees said:e.g. in bound dataset I have a field named "type" that defines the type of some info and depending on value of type I've to show DatePickers, Checkbox, combo, textbox in single column of grid in each row.
Okay, that makes things a lot more complicated.
Are you assigning the UltraDropDown to the entire column, or just one cell?
Either way, there's no way to set a DataType on an individual cell. So your unbound column will have to use a DataType that all of the possible types can support, such as object.
Even then, some of the editors might not know how to deal with the object type directly and it may require you to use a DataFilter.
There's really not enough information here to guess what the problem is beyond a conflict in the data types. Perhaps you could post a small sample project demonstrating what you are trying to do.
Here is my code to add different type of controls in each row, it's working well except drop down/combo. private void Grid_InitializeRow(object sender, InitializeRowEventArgs e) { UltraGridRow row = e.Row;// Adding UltraDropDown to grid column but there's a problem, DropDown showing all columns as table instead of just DisplayMember as simple drop down UltraDropDown dpd = new UltraDropDown(); dpd.DisplayMember = "Caption"; dpd.ValueMember = "Operator"; dpd.SetDataBinding(dtView, null, false, false); row.Cells[10].ValueList = dpd;// Adding UltraCombo to grid column but it's not populated with data and empty combo shown to grid column UltraComboEditor cmb = new UltraComboEditor(); cmb.DisplayMember = "Caption"; cmb.ValueMember = "Operator"; cmb.DataSource = dtView; row.Cells[10].EditorComponent = cmb;// This code adds different type of controls in every row depending on value if (row.Cells[5].Text == "string") { UltraTextEditor txt = new UltraTextEditor(); row.Cells[11].EditorComponent = txt; row.Cells[12].EditorComponent = txt; } else if (row.Cells[5].Text == "date") { UltraDateTimeEditor dt = new UltraDateTimeEditor(); row.Cells[11].EditorComponent = dt; row.Cells[12].EditorComponent = dt; } else if (row.Cells[5].Text == "bool") { UltraCheckEditor chk = new UltraCheckEditor(); row.Cells[11].EditorComponent = chk; row.Cells[12].EditorComponent = chk; } else if (row.Cells[5].Text == "int") { UltraNumericEditor num = new UltraNumericEditor(); num.MinValue = 1; num.MaxValue = 100; row.Cells[11].EditorComponent = num; row.Cells[12].EditorComponent = num; } }
microsoftees said:// Adding UltraDropDown to grid column but there's a problem, DropDown showing all columns as table instead of just DisplayMember as simple drop down
If you only want the list to display as a single-column or a dropdown with no columns, then you should use a ValueList instead of the UltraDropDown control. You could also use an UltraComboEditor instead of UltraCombo.
Or, you could keep using the UltraDropDown and hide the columns you don't want. The UltraDropDown is just like an UltraGrid, it has a DisplayLayout with the bands. So you could handle it's InitializeLayout event and loop through the columns and hide the ones you don't want to display. You could use use the ColHeadersVisible property to hide the column headers.
microsoftees said:// Adding UltraCombo to grid column but it's not populated with data and empty combo shown to grid column
This is probably not getting any data because you are declaring the UltraCombo in code and you never parent it to any container. This means it has no BindingContext, so it will be unable to get any data from the BindingManager. It also means that this control will never be disposed and so it could cause a memory leak. In fact, this seems to be true for all of the controls you are creating here. You need to make sure you dispose of these controls when you don't need them any more.
You can either parent the UltraCombo to the form by adding it to the form's Controls collection, or set UltraCombo.BindingContext to a new BindingContext.
Mike,Thanks for you help, problem solved.
But I want to understand this thing. Why UltraCombo need to be parent while UltraDropDown, ValueList doesn't need parenting :).
What's difference in their construction.
Hi, I am having the exact same issue with my ultra combo control as explained here. I am using ultra combo to populate a data table values from database in the dropdown in a grid. The package is returning only one column from one of the table in the database. I can get the dropdown button in the cell as expected, when I click that button, I find no values but a scroller in the dropdown.
Can somebody please let me know how do I parent my control?
Hi Sir,
The values are coming up in dropdownlist now and when I am saving the record after selecting a certain value, it does get saved in database but doesn't stay in UI dropdown textbox. Also, This grid is getting loaded with certain values as well, but no value get selected by default in the dropdown textbox, although there is a value present in database.
Could you please help me out?
Thanks,Harshit
Yes, this was the issue. Now the values have been populated. I know this was a sill one but thanks a lot.
Now, in this form, I have a UltraTextEditor, whose value is getting populated from a previous page. This value is present in the dropdown, that we have implemented. I need the default selected value of this dropdown to be the same value that is present there in this ultratexteditor. Is it possible?
Note: since my datatable(that contains the VALUELIST getting populated in the dropdown) has only one column, I don't have a n Index for the dropdownitems.
Hi Harshit,
Well.. it's hard to tell from just a code snippet, but it looks like you said your data source has only one column and you are hiding that column.
uddClini_bud_id.DisplayLayout.Bands[0].Columns["BUD_ID"].Hidden = true;
So that would certainly explain all of the behavior you are describing. You are hiding the only column in the dropdown, so there's nothing to display.
This is my current code in View.cs
BindingContext bc = new System.Windows.Forms.BindingContext();
uddClini_bud_id.BindingContext = bc;
//e.Layout.Bands[1].Columns["CLIN_BUDGET_ID"].DefaultCellValue.Equals(uteBindBudId.Text);
uddClini_bud_id.DataSource = Lookup.ClinicalBudIdMapping.ClinicalBudIdMappingDt;
uddClini_bud_id.ValueMember = "BUD_ID";
uddClini_bud_id.DisplayMember = "BUD_ID";
uddClini_bud_id.DropDownWidth = 250;
//uddClini_bud_id.DisplayMember.StartsWith("BUD_ID", true, null);
uddClini_bud_id.DisplayLayout.Bands[0].Columns["BUD_ID"].Width = e.Layout.Bands[1].Columns["CLIN_BUDGET_ID"].Width;
e.Layout.Bands[1].Columns["CLIN_BUDGET_ID"].ValueList = uddClini_bud_id;
e.Layout.Bands[1].Columns["CLIN_BUDGET_ID"].ValueList.ShouldDisplayText.Equals(true);
//e.Layout.Bands[1].Columns["CLIN_BUDGET_ID"].DataType.ToString();
//e.Layout.Bands[1].Columns["CLIN_BUDGET_ID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
e.Layout.Bands[1].Columns["CLIN_BUDGET_ID"].FilterEvaluationTrigger = FilterEvaluationTrigger.OnEnterKeyOrLeaveCell;
e.Layout.Bands[1].Columns["CLIN_BUDGET_ID"].FilterOperandStyle = FilterOperandStyle.DropDownList;
e.Layout.Bands[1].Columns["CLIN_BUDGET_ID"].FilterOperandStyle = FilterOperandStyle.Edit;
And this is there in the designer.cs of this form. Some of it (the last 5 lines) got created by itself and the rest of it has been added by me.
this.uddClini_bud_id.DisplayLayout.Appearance = appearance121;
//this.uddClini_bud_id.DisplayLayout.BandsSerializer.Add(ultraGridBand17);
this.uddClini_bud_id.DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
this.uddClini_bud_id.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False;
this.uddClini_bud_id.DisplayLayout.GroupByBox.Appearance = appearance122;
this.uddClini_bud_id.DisplayLayout.GroupByBox.BandLabelAppearance = appearance123;
this.uddClini_bud_id.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
this.uddClini_bud_id.DisplayLayout.GroupByBox.PromptAppearance = appearance124;
this.uddClini_bud_id.DisplayLayout.MaxColScrollRegions = 1;
this.uddClini_bud_id.DisplayLayout.MaxRowScrollRegions = 1;
this.uddClini_bud_id.DisplayLayout.Override.ActiveCellAppearance = appearance125;
this.uddClini_bud_id.DisplayLayout.Override.ActiveRowAppearance = appearance126;
this.uddClini_bud_id.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Dotted;
this.uddClini_bud_id.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Dotted;
this.uddClini_bud_id.DisplayLayout.Override.CardAreaAppearance = appearance127;
this.uddClini_bud_id.DisplayLayout.Override.CellAppearance = appearance126;
//this.ucRecipient.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
this.uddClini_bud_id.DisplayLayout.Override.CellPadding = 0;
this.uddClini_bud_id.DisplayLayout.Override.GroupByRowAppearance = appearance129;
this.uddClini_bud_id.DisplayLayout.Override.HeaderAppearance = appearance130;
this.uddClini_bud_id.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
this.uddClini_bud_id.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.WindowsXPCommand;
this.uddClini_bud_id.DisplayLayout.Override.RowAppearance = appearance131;
this.uddClini_bud_id.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
this.uddClini_bud_id.DisplayLayout.Override.TemplateAddRowAppearance = appearance132;
this.uddClini_bud_id.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
this.uddClini_bud_id.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
this.uddClini_bud_id.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;
//
this.uddClini_bud_id.Location = new System.Drawing.Point(3, 529);
this.uddClini_bud_id.Name = "uddClini_bud_id";
this.uddClini_bud_id.Size = new System.Drawing.Size(94, 14);
this.uddClini_bud_id.TabIndex = 101;
this.uddClini_bud_id.Visible = false;
I think the image has been attached now.
Also, I was talking about FilterOperandStyle.
Though, you got it right sir, this is exactly the issue I have. However, I have checked for appearance and creationFilter/draw filter. These have not been applied in my code. I don't know where to find StyleManager.Load. I understand that this is something done inside my code only, something is sort of setting the visibility of these values to false. but I am unable to find that thing.
Do you think I should start over by using UltracomboEditor? or anything else?