Hi All,
Am binding ValueListItems to the UltraGridCell as showm below.
vl1.ValueListItems.Add(1, "Yes");
this.ultraGrid1.ActiveCell.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
When i change an item in the list one new form should be opened ,this is what my requiresment is.
Not sure about the event which will be fired after the valuelist item is changed, i have tried with ListChanged event but no use,
Could any one of yoy help me on this,
Thanks in Advance,
Pavana
Hi Pavana,
I would use the CellChange even of the grid. Note that this event will fire no matter how the value of the cell is changed - so it could be triggered by the user entering the cell and using the up/down arrow keys.
Also, you have to use the Text property of the cell to get the new selected value, you can't use Value, because Value will not be updated, yet.
Hi Mike,
I also having the same problem, i ve to write few validations on selection change of value list item. How do I get selected value of valuelist on cell change event. We can not use Text property for comparision, since it is populated from database.
Thanks,Abhishek
You probably need to have multiple ValueLists in this case. You don't want to have a single ValueList assigned to the column and constantly be adding and removing items - this will cause problems because the grid won't be able to match up the DataValue/DisplayText for some cells where the item no longer exists.
Your best bet is to create a ValueList for each set of values you need. In other words, one list with everything and one wihout the "keyNa N/A" option.
Then you would assign the appropriate ValueList to the Cell (not the column).
Hi,
I have applied the value list property of the column as mentioned below.
DataTable dt = new DataTable();dt.Columns.Add("CustomerID", typeof(int));dt.Columns.Add("OriginalCombo", typeof(string));dt.Columns.Add("Address", typeof(string));dt.Columns.Add("DateOfJoin", typeof(DateTime));dt.Columns.Add("ChangeCombo", typeof(string));
ultraGrid1.DataSource = dt;
dt.Rows.Add(new object[ { 1, "keyYes", "South Street", DateTime.Now,, "keyYes"});dt.Rows.Add(new object[ { 2, "keyNo", "12/4 S MarkD", DateTime.Now, "keyYes"});dt.Rows.Add(new object[ { 3, "keyNa", "23/45 Honai", DateTime.Now,"keyYes" });dt.Rows.Add(new object[ { 4, "keyNo", "233 Walter Street", DateTime.Now,"keyYes" });
ValueList vl1 = new ValueList(); vl1.ValueListItems.Add("keyYes", "Yes");vl1.ValueListItems.Add("keyNo", "No"); vl1.ValueListItems.Add("KeyNa", "N/A"); ultraGrid1.DisplayLayout.Bands[0].Columns[1].ValueList = vl1;
ValueList vl2 = new ValueList(); vl1.ValueListItems.Add("keyYes", "Yes");vl1.ValueListItems.Add("keyNo", "No"); ultraGrid1.DisplayLayout.Bands[0].Columns[4].ValueList = vl2;
Now based on the value (say "keyBuy") in the datatable, the combo items in the cell get selected in OriginalCombo and ChangeCombo column of grid.Now whenever i change the value of the "ChangeCombo" value to "keyNo", i need to remove the item "keyNa N/A" from the OriginalComboand whenever i change the value of the "ChangeCombo" value to "keyYes", i need to add the item "keyNa N/A" in my original Combo.
For this i want to do with cellchange event.
How to achieve this? Please note that, the adding or removing of items from original combo happens only to that specific cell and not to the entire column.
Thanks
I made the following:
In the CellChange event I set the ActiveCell of the Grid to the next cell and in the AfterCellUpdate event I read out the value of the Cell.
Regards,
Patrick
Hi Patrick,
ValueList on the cells allows you to set the ValueList being used for that single cell. ValueListResolved is read-only and returns the ValueList that is actually being used by the cell.
The reason for the two different properties is that the cell could be using the ValueList from the Column. If you do not assign a ValueList to the cell and you do assign a ValueList to the column, then the ValueListResolved of the cell will return the ValueList being used by that cell, which is the ValueList on the column. If you set the ValueList on the cell, then ValueListResolved will always return the ValueList of the cell.
I'm not really sure I understand the problem you are having. You say you have duplicate text on the items of the ValueList in column A? If that's the case, then you are right, you can't use the Text of column A inside the ValueChanged event. I guess in that guess you would have to use some property on the ValueListResolved of the cell in column A to determine the selected row.
My problem is the following:
I have one row with 3 cells (e.g. cells A, B and C) each cell has a valuelist and if the value of cell A chages I have to set a new valuelist for Cell B and select a specific value of cell B and if the value of cell B changes I have to recolor cell C (the color depends on the value of Cell B).
The text of Cell A is not unique because the further data is written in Cell B and I can't write the text of Cell A and B in one cell.
I hope I could explain my problem.
Now my problem is that when I catch the CellChange event, that the Value property of the Cell ist not the current selected value and in the valuelistresolved there seems to be always the selected value of Cell A.
Could you explain the difference between ValueListResolved and ValueList sometimes SelectedItem of ValueList is null sometimes SelectedItem of ValueListResolved is null and sometimes SelectedItem of both lists are null?