I am trying to figure out how to add a valuelist to the ultragrid but everything I've found and tried has not worked. I have to be missing something. If someone could step me through each step for just a simple list of a couple of items, I could figure out the rest from there.
Thanks,Kevin
Are you just trying to create a dropdown list in one of the columns in the grid? If that's the case, then here's a small snippet that might help:
-------------------Infragistics.Win.ValueList vl = new Infragistics.Win.ValueList();for (int i = 1; i <= 10; i++){ vl.ValueListItems.Add(i);}
this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].ValueList = vl;this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;----------------
All this does is create a simple valuelist, adds 10 items to it, associates it with the first column in the top level (band 0) of the grid and sets the style of the column to be a DropDownList. There's also a BindableValueList object in case you just want to bind to a source of data instead of building up the ValueList by hand.
Pretty much, yeah.
But I'm using VB.Net to do this so I modified your code above to look like this:
Dim vl As New Infragistics.Win.ValueList()
Dim i As Integer
For i = 1 To 10
vl.ValueListItems.Add(i)
Next i
UltGrd.DisplayLayout.Bands(0).Columns(1).ValueList = vlUltGrd.DisplayLayout.Bands(0).Columns(1).Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList
I have this in the form load section of my code but it's not showing anything when I run the project, just a blank ultra grid. What am I missing?
Thanks,
Kevin
That was it, I wasn't binding it to anything.
Have you bound the grid to any data? My code works under the assumption that you've already filled the grid with info by binding it to something. Even if you want an empty grid with the ability to add rows, you'll need to bind it to something that represents the data you want your users to add, then turn on the AllowAddNew, AllowUpdate, and CellClickAction properties (all 3 are off of the Override object under DisplayLayout). For instance, the following code:
AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.FixedAddRowOnBottomAllowUpdate = Infragistics.Win.DefaultableBoolean.TrueCellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.Edit
will turn on a fixed row for adding new data, allow the users to edit grid cells, and put cells into edit mode when a user clicks on it.