Ok, so I have UltraCombos in the windows, with data, and responding properly. I'd like to clean them up now. I'm finding the documentation very sparse though, so some guidance would be greatly appreciated!
1) how do I turn off the headers? In our combos we don't really need them. I can't see anything like "header" in the docs that seems relevant.
2) I'm VERY confused about selection of columns from a multi-column source. The examples in the docs do the opposite of what I want, and I can't find any discussion...
Most of our combos have two columns, ID and string. I want the ID to be hidden and the string to be displayed. So following the docs, I did...
// Bind the combo to a data source. this.ultraCombo1.DataSource = this.dataSet11; this.ultraCombo1.DataMember = ""; // Set the ValueMember and DisplayMember to appropriate column keys. this.ultraCombo1.ValueMember = "ProductID"; this.ultraCombo1.DisplayMember = "ProductName";
This doesn't seem to do anything. Both columns still appear in the dropped-down box. And why does this example set the DataMember to ""? I'm not sure I understand that.
In the cases where I DO want more than one column, the docs don't have any examples! Does anyone else have some they could fire to me?
Maury
Hi Maury,
mmarkowitz said:1) how do I turn off the headers? In our combos we don't really need them. I can't see anything like "header" in the docs that seems relevant.
private void ultraCombo1_InitializeLayout(object sender, InitializeLayoutEventArgs e) { e.Layout.Bands[0].ColHeadersVisible = false; }
}
mmarkowitz said:This doesn't seem to do anything.
What this does is tells the combo to use the ProductID from the selected row as the Value of the Combo, but to display the ProductName in the text portion of the combo. It has no effect on the visibility of those columns on the list, it's all about how the text box part of the combo works.
To hide a column, you would do this:
private void ultraCombo1_InitializeLayout(object sender, InitializeLayoutEventArgs e) { e.Layout.Bands[0].Columns["ProductID"].Hidden = true; }
mmarkowitz said:And why does this example set the DataMember to ""?
That seems redundant. DataMember allows you to choose a specific table from a multi-table data set. If you don't specify the name of a table, then the combo will simply use the first table in the data set. Specifying an empty string doesn't seem to have any point, since null is already the default for DataMember. Maybe it was put into the sample just in case the DataMember was already set to something else.
mmarkowitz said:In the cases where I DO want more than one column, the docs don't have any examples! Does anyone else have some they could fire to me?
There are samples of using the the UltraCombo included in the NetAdvantage SDK. SO you might want to download that if you have not already done so.
I'm not sure I understand what you mean by your question, though. The Combo will show all of the columns in the data source. And you can hide them using the Hidden property as I mentioned above.
>The Combo will show all of the columns in the data source. And you can
>hide them using the Hidden property as I mentioned above.
My data source is an entity with about 50 fields, and I want to display three of them. Hiding all the others is tiring.
SOMETIMES you can get the layout editor to come up and use Hide All. However, I've had a number of occasions where it does not appear and you go do an alternate editor where the columns are shown in a tree view in the middle pane. You cannot Hide All from this screen.
Personally, I find it easier to do things like this at run-time, rather than in the Designer. In the InitializeLayout event of the grid, loop through the columns and hide all except the ones you want to display.