/// <summary> /// Gets the filter compare value. /// </summary> /// <param name="control">The control.</param> /// <param name="filterMode">The filter mode.</param> /// <returns></returns> public override string GetFilterCompareValue( Control control, FilterMode filterMode ) { bool filterValueControlVisible = true; var filterField = control.FirstParentControlOfType<FilterField>(); if ( filterField != null && filterField.HideFilterCriteria ) { filterValueControlVisible = false; } if ( filterMode == FilterMode.SimpleFilter && filterValueControlVisible ) { // hard code to Contains when in SimpleFilter mode and the FilterValue control is visible return ComparisonType.Contains.ConvertToInt().ToString(); } else { return base.GetFilterCompareValue( control, filterMode ); } }
/// <summary> /// Gets the filter compare value. /// </summary> /// <param name="control">The control.</param> /// <param name="filterMode">The filter mode.</param> /// <returns></returns> public virtual string GetFilterCompareValue( Control control, FilterMode filterMode ) { var ddlCompare = control as RockDropDownList; if ( ddlCompare != null ) { bool filterValueControlVisible = true; var filterField = control.FirstParentControlOfType<FilterField>(); if ( filterField != null && filterField.HideFilterCriteria ) { filterValueControlVisible = false; } // if the CompareControl is hidden, but the ValueControl is visible, pick the appropriate ComparisonType if ( !ddlCompare.Visible && filterValueControlVisible ) { if ( filterMode == FilterMode.SimpleFilter ) { // in FilterMode.SimpleFilter... if ( FilterComparisonType == ComparisonHelper.BinaryFilterComparisonTypes ) { // ...if the compare only support EqualTo/NotEqual to, return EqualTo return ComparisonType.EqualTo.ConvertToInt().ToString(); } if ( FilterComparisonType == ComparisonHelper.StringFilterComparisonTypes || FilterComparisonType == ComparisonHelper.ContainsFilterComparisonTypes ) { // ... if the compare is the string or list type comparison, return Contains return ComparisonType.Contains.ConvertToInt().ToString(); } } } return ddlCompare.SelectedValue; } return string.Empty; }