Hello,
I'm trying to add an UltraDropDown to allow the user to pick specific values for a cell from a list. It works fine if I define the ValueList at the Cell level but I was thinking it would be more efficient to do it at the column level: InitializeLayoutImpl( object sender_, InitializeLayoutEventArgs args_ ) { UltraDropDown udd = new UltraDropDown(); udd.DataSource = "ColumnName"; args_.Layout.Bands[ 0 ].Columns[ "ColumnName" ].ValueList = udd; } However, whenever I do this, I get the below exception:1 19 18:05:39 ebbit190960d [5344,OMWP] 167 Error Concord/Host/2.5.0.38374 [3904] [ Error invoking click handler, Exception='System.NullReferenceException: Object reference not set to an instance of an object. at Infragistics.Win.UltraWinGrid.UltraGridBand.WireDataSource() at Infragistics.Win.UltraWinGrid.UltraGridBand.InitListManager(BindingManagerBase bindingManager, String dataMember, UltraGridBand[ oldBands) at Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated(BindingManagerBase bindingManager) at Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated() at Infragistics.Win.UltraWinGrid.UltraGridBase.Set_ListManager(Object newDataSource, String newDataMember) at Infragistics.Win.UltraWinGrid.UltraGridBase.set_DataSource(Object value) I'm assuming this has something to do with defining this binding on summary columns where it wouldn't make sense or the like...so I'm just wondering if this useage is supported or if I should be setting this at the cell level each time.
Thanks
You cannot bind the UltraDataSource simply based on the name of a column that exists in a different control; the UltraDropDown has the same restrictions on data sources that the UltraGrid has.
-Matt
Hi Matt,
Yeah, that was my bad...was way too tired to be doing anything that day. I guess the general question remains though. In this case, I have no choice but to define the UltraDropDown on each cell as the row is created (since the data source is different possibly for every row). In that case, what is the best place to do this? Currently, I'm adding some code here: private void Grid_InitializeRow( object sender, InitializeRowEventArgs e ) { //Setup the UltraDropDown and bind to the Row's underlying DataSource UltraDropDown udd = new UltraDropDown(); udd.DataSource = //Something goes here cell.ValueList = udd; } But this method seems to get called alot more than I want. In fact, many times, e.Row as given by the event, is already setup with the right UltraDropDown meaning that I'm getting this event multiple times for the same row? Am I doing something wrong here?
Ah great, this made a big difference.
You could check the e.ReInitialize parameter so that you don't unnecessarily recreate those controls. You could also check the cell's ValueList property to see if you've already added the UltraDropDown.