本文整理汇总了C#中Rock.Web.UI.Controls.FilterField.SetCheckBoxChecked方法的典型用法代码示例。如果您正苦于以下问题:C# FilterField.SetCheckBoxChecked方法的具体用法?C# FilterField.SetCheckBoxChecked怎么用?C# FilterField.SetCheckBoxChecked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Web.UI.Controls.FilterField
的用法示例。
在下文中一共展示了FilterField.SetCheckBoxChecked方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFilterControl
/// <summary>
/// Creates the filter control.
/// </summary>
/// <param name="parentControl">The parent control.</param>
/// <param name="filter">The filter.</param>
/// <param name="reportEntityType">Type of the report entity.</param>
/// <param name="filteredEntityTypeName">Name of the filtered entity type.</param>
/// <param name="setSelection">if set to <c>true</c> [set selection].</param>
/// <param name="selectedDataFieldGuids">The selected data field guids.</param>
/// <param name="configurableDataFieldGuids">The configurable data field guids.</param>
/// <param name="rockContext">The rock context.</param>
private void CreateFilterControl(
Control parentControl,
DataViewFilter filter,
EntityType reportEntityType,
bool setSelection,
List<Guid> selectedDataFieldGuids,
List<Guid> configurableDataFieldGuids,
List<Guid> togglableDataFieldGuids,
RockContext rockContext )
{
try
{
var filteredEntityTypeName = EntityTypeCache.Read( reportEntityType ).Name;
if ( filter.ExpressionType == FilterExpressionType.Filter )
{
var filterControl = new FilterField();
filterControl.FilterMode = FilterMode.SimpleFilter;
bool filterIsVisible = selectedDataFieldGuids.Contains( filter.Guid );
bool filterIsConfigurable = configurableDataFieldGuids.Contains( filter.Guid );
bool showCheckbox = togglableDataFieldGuids.Contains( filter.Guid ) || !filterIsConfigurable;
filterControl.Visible = filterIsVisible;
parentControl.Controls.Add( filterControl );
filterControl.DataViewFilterGuid = filter.Guid;
filterControl.HideFilterCriteria = !filterIsConfigurable;
filterControl.ID = string.Format( "ff_{0}", filterControl.DataViewFilterGuid.ToString( "N" ) );
filterControl.FilteredEntityTypeName = filteredEntityTypeName;
if ( filter.EntityTypeId.HasValue )
{
var entityTypeCache = Rock.Web.Cache.EntityTypeCache.Read( filter.EntityTypeId.Value, rockContext );
if ( entityTypeCache != null )
{
filterControl.FilterEntityTypeName = entityTypeCache.Name;
}
}
filterControl.Expanded = true;
filterControl.ShowCheckbox = filterIsVisible && showCheckbox;
var reportEntityTypeCache = EntityTypeCache.Read( reportEntityType );
var reportEntityTypeModel = reportEntityTypeCache.GetEntityType();
var filterEntityType = EntityTypeCache.Read( filter.EntityTypeId ?? 0 );
var component = Rock.Reporting.DataFilterContainer.GetComponent( filterEntityType.Name );
if ( component != null )
{
string selectionUserPreference = null;
bool? checkedUserPreference = null;
if ( setSelection && filterIsVisible && filterIsConfigurable )
{
selectionUserPreference = this.GetUserPreference( string.Format( "{0}_{1}_Selection", GetReportDataKeyPrefix(), filterControl.DataViewFilterGuid.ToString( "N" ) ) );
}
else if ( setSelection && filterIsVisible && !filterIsConfigurable )
{
checkedUserPreference = this.GetUserPreference( string.Format( "{0}_{1}_Checked", GetReportDataKeyPrefix(), filterControl.DataViewFilterGuid.ToString( "N" ) ) ).AsBooleanOrNull();
}
if ( checkedUserPreference.HasValue )
{
filterControl.SetCheckBoxChecked( checkedUserPreference.Value );
}
if ( filterIsVisible && !filterIsConfigurable )
{
// not configurable so just label it with the selection summary
filterControl.Label = component.FormatSelection( reportEntityTypeModel, filter.Selection );
}
else if ( component is Rock.Reporting.DataFilter.PropertyFilter )
{
// a configurable property filter
var propertyFilter = component as Rock.Reporting.DataFilter.PropertyFilter;
if ( setSelection )
{
var selection = filter.Selection;
if ( !string.IsNullOrWhiteSpace( selectionUserPreference ) )
{
selection = propertyFilter.UpdateSelectionFromUserPreferenceSelection( selection, selectionUserPreference );
}
selection = propertyFilter.UpdateSelectionFromPageParameters( selection, this );
try
{
filterControl.SetSelection( selection );
}
//.........这里部分代码省略.........