/// <summary> /// This eventhandler handles the OnServerValidate event fired from the "DupeValidator" object. /// It checks the text input into the txtName control and determines if a group by that name already exists /// </summary> /// <param name="source">The object that fired this event</param> /// <param name="args">ServerValidateEventArgs passed to the eventhandler</param> protected void CheckForDuplicateGroupName(object source, ServerValidateEventArgs args) { if (string.IsNullOrWhiteSpace(txtName.Text)) { args.IsValid = true; } else { var grouping = new Grouping(_environmentParametersViewModel); args.IsValid = !grouping.GetDuplicateExists(txtName.Text); } }