Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
275
Using UltraValidator with UltraCombo control to check value in list
posted

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?

Parents
  • 25665
    Offline posted

    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);
    

Reply Children
No Data