Hi. I need to set value to cell that not in value list, it sets but it shows in cell myValue.ToString() string , is it possible to handle what cell will show if value not in value list?
so, my goal is to show value in cell but don't allow user to chose it from dropdown. Please advice.
Hello Kyril,
Thank you for contacting Infragistics Support.
I suppose your column is of type “object” and you are trying to set its value to an instance of some class. If this is your case what you need to do is to override the ToString() method of your class. Actually if the cell is of type “object” it calls ToString method of the underling object in order to display its string representation.
Please find attached a sample solution implementing UltraGrid with cell of type “object”. Please note if you set the value of a cell to an instance of MyValue class it will display UltraGridValueListItem.MyValue. However if you uncomment ToString() method in MyValue class the cell will show correct value.
Please let me know if this is what you are looking for or if I am missing something.
So it's a good idea, but i cann't ovverite ToString method of my class. I use value list to show string that i need for certain value. However if value not in value list is shows me result of ToString method. Is there any way to add item to ValueList but don't allow user to select it, maybe make it invisible in dropdown?
Thank you for your feedback.
In order to be able to understand in details your sensation can you please clarify the next points:
1. Why you cannot override ToString method of your class?
2.What is the type of the values in your ValueList?
3. How you set the DiplayText property for each item in the value list?
4. What is the type of the value which you set to the cell that has VlueList (and this value is not part of the ValuelIst)
It will help if you can provide a small, isolated sample application that demonstrates your approach.
Waiting for your feedback.
1. I do not have access to display value inside class.
2. MyClass
3. i create valuelist :
var vl= new ValueList();
vl.ValueListItems.Add(new MyClass{Value = value1}, "MyClassValue1");
vl.ValueListItems.Add(new MyClass{Value = value2}, "MyClassValue2");
vl.ValueListItems.Add(new MyClass{Value = value3}, "MyClassValue3");
grid_.DisplayLayout.Bands[0].Columns[columnName_].ValueList = vl;
4. Type of value is MyClass. for example i set value new MyClass{Value = value4};
I want to help with showing special text for value that should be displayed in cell but should be not selectable from dropdown.
In my example i need to show all values in cell but user should can ability to select values that not Obsolete. Is there way to set cell text or something else? Or add value to value list but do not show it in dropdown ? Or maybe is there a way to filter values that shown in dropdown?
Sample is atached
I am just checking about the progress of this issue. Let me know if you need my further assistance on it.
Thank you for using Infragistics Components.
Hi,
Please, check the attached sample where I have set the Style of the grid's column to DropDownList. There is no way now to type or select the hidden row with Activation set to Disabled. One more point - setting the DropDownStyle to UltraCombo has no effect here. UltraCombo is actually provides its editor to the grid. What you do next is setting all the necessary properties to the grid's column / cell.
Thank you for using Infragistics Controls.
As far as I can tell, setting the Activation property on the UltraCombo's row, hidden or not, does not prevent a hidden value from being typed in. This is with an UltraCombo set to the DropDownList style with LimitToList set True. You can always check in BeforeRowUpdate, but Activation has no effect in this instance.