I am trying to create a WinForm that contains an UltraWinGrid that will contain rows of provisions. Each row contains critera for a provision (which printer, which paper size, et al.) Each criterion is a single selection from a list of possible selections (e.g. Printer1, Printer2, etc.). The possible selections are only known at runtime, so to select one I plan to create a ValueList of possibilities for each column, define each UltraWinGrid Band.Column.Style as a DropDownList, and assign the column.ValueList at runtime. A possible provisioning is:
Printer1 8x11 BondPrinter2 11x16 Bond
The selections available for all rows are the same, only the selection value for each row can be different. The value of each cell in the DataSource is an integer; I populate the ValueList with integer IDs and string DisplayText and want the DropDownList to display the text of the associated ID. Each row should be different, but let's not worry about that yet.
A screen shot of the UltraGrid properties follows:
(The editor removed my picture. It is available at http://tinypic.com/r/33o6xwg/6)
I cannot get this to work; trying to set the ValueList with:
ugAutoHold.DisplayLayout.Bands[0].Columns["Printer"].ValueList = targetPrinters;
Throws a null reference exception because ugAutoHold.DisplayLayout.Bands[0].Columns is always empty.
I have read http://es.infragistics.com/community/forums/t/67869.aspxbut cannot use that as my ValueLists are not know until runtime.
Hi,
So the question is, why is the columns collection empty?
What kind of DataSource are you using for your grid?
In what event are you attempting to set the ValueList on the column? I recommend using the InitializeLayout event for this if you are not already doing so. This will ensure that the columns have already been created since this event fires after the grid is bound to a data source.
I have made some progress, and seem to have some misconceptions. Can you tell me if the following is correct?
These are the conclusions I have come to after many hours of experimentation. I am not complaining, I just need to know if these are correct so I am not going down the wrong path.
Hello,
Directly to your questions in the sequence you have asked:
1) Yes. This is the moment the control fires the IntializeLayout event, you could use it for these purposes.
2) & 3) Please specify about what properties you are talking here. You could alter many things of course.
4) Yes, you could go that way.
Please do not hesitate to contact me if you need any additional assistance.