Example #1
0
        private static void SelectByTextOrValueMultiple(this SelectList selectList, Constraint constraint)
        {
            // This is copied from SelectList.SelectMultiple
            var options = selectList.Options.Filter(constraint);

            if (options.Count == 0)
            {
                throw new SelectListItemNotFoundException(constraint.ToString(), selectList);
            }

            foreach (var option in options)
            {
                if (option.Selected)
                {
                    continue;
                }
                option.SetAttributeValue("selected", "true");
            }

            selectList.FireEvent("onchange");
        }