Hi,
I am trying top use the UltraValidator with an UltraCombo control to check if the displayed text matches an item in the dropdown list. I created the condition using this code:
ultraValidator.GetValidationSettings(ultraComboTreatmentPlant).Condition = new ContainedInListCondition(ultraComboTreatmentPlant.Rows.ToList(), ListItemMatchMode.DisplayText);
This doesn't work. What to I need to do to get this working?
Hello Tracy,
Thank you for contacting Infragistics!
This isn’t working because you are passing a list of UltraGridRow objects and the validator is comparing to a string do they will never match. You have to pass the DisplayMember field of the row instead.
List<string> list = new List<string>(this.ultraCombo1.Rows.Count); string displayMemberResolved = this.ultraCombo1.DisplayMemberResolved; var displayMemberColumn = this.ultraCombo1.DisplayLayout.Bands[0].Columns[displayMemberResolved]; foreach (var row in this.ultraCombo1.Rows) { list.Add(row.GetCellText(displayMemberColumn)); } ultraValidator1.GetValidationSettings(this.ultraCombo1).Condition = new ContainedInListCondition(list, ListItemMatchMode.DisplayText);
Hi Mike,
Thank you for the code. This works fine. It would be great if a method to do this was included with the control.