Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
762
Cannot populate UltraWinGrid with DropDownList
posted

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     Bond
Printer2    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:

WinGrid design screen shot

(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.

Parents
  • 469350
    Offline posted

    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.

Reply Children