当前位置: 首页>>代码示例>>C#>>正文


C# FilterField.RockBlock方法代码示例

本文整理汇总了C#中Rock.Web.UI.Controls.FilterField.RockBlock方法的典型用法代码示例。如果您正苦于以下问题:C# FilterField.RockBlock方法的具体用法?C# FilterField.RockBlock怎么用?C# FilterField.RockBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rock.Web.UI.Controls.FilterField的用法示例。


在下文中一共展示了FilterField.RockBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateChildControls

        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls( Type entityType, FilterField filterControl, FilterMode filterMode )
        {
            var containerControl = new DynamicControlsPanel();
            containerControl.ID = string.Format( "{0}_containerControl", filterControl.ID );
            containerControl.CssClass = "js-container-control";
            filterControl.Controls.Add( containerControl );

            // Create the field selection dropdown
            var ddlEntityField = new RockDropDownList();
            ddlEntityField.ID = string.Format( "{0}_ddlProperty", filterControl.ID );
            ddlEntityField.ClientIDMode = ClientIDMode.Predictable;
            containerControl.Controls.Add( ddlEntityField );

            // add Empty option first
            ddlEntityField.Items.Add( new ListItem() );
            var rockBlock = filterControl.RockBlock();
            var entityTypeCache = EntityTypeCache.Read( entityType, true );

            this.entityFields = EntityHelper.GetEntityFields( entityType );
            foreach ( var entityField in this.entityFields.OrderBy(a => !a.IsPreviewable).ThenBy(a => a.FieldKind != FieldKind.Property ).ThenBy(a => a.Title) )
            {
                bool isAuthorized = true;
                bool includeField = true;
                if ( entityField.FieldKind == FieldKind.Attribute && entityField.AttributeGuid.HasValue)
                {
                    if ( entityType == typeof( Rock.Model.Workflow ) && !string.IsNullOrWhiteSpace(entityField.AttributeEntityTypeQualifierName) )
                    {
                        // Workflows can contain tons of Qualified Attributes, so let the WorkflowAttributeFilter take care of those
                        includeField = false;
                    }

                    var attribute = AttributeCache.Read( entityField.AttributeGuid.Value );
                    if ( includeField && attribute != null && rockBlock != null )
                    {
                        // only show the Attribute field in the drop down if they have VIEW Auth to it
                        isAuthorized = attribute.IsAuthorized( Rock.Security.Authorization.VIEW, rockBlock.CurrentPerson );
                    }
                }

                if ( isAuthorized && includeField )
                {
                    var listItem = new ListItem( entityField.Title, entityField.Name );

                    if ( entityField.IsPreviewable )
                    {
                        listItem.Attributes["optiongroup"] = "Common";
                    }
                    else if (entityField.FieldKind == FieldKind.Attribute)
                    {
                        listItem.Attributes["optiongroup"] = string.Format( "{0} Attributes", entityType.Name );
                    }
                    else
                    {
                        listItem.Attributes["optiongroup"] = string.Format( "{0} Fields", entityType.Name );
                    }

                    ddlEntityField.Items.Add( listItem  );
                }
            }

            ddlEntityField.AutoPostBack = true;

            // grab the currently selected value off of the request params since we are creating the controls after the Page Init
            var selectedValue = ddlEntityField.Page.Request.Params[ddlEntityField.UniqueID];
            if ( selectedValue != null )
            {
                ddlEntityField.SelectedValue = selectedValue;
                ddlEntityField_SelectedIndexChanged( ddlEntityField, new EventArgs() );
            }

            ddlEntityField.SelectedIndexChanged += ddlEntityField_SelectedIndexChanged;

            return new Control[] { containerControl };
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:78,代码来源:PropertyFilter.cs

示例2: RegisterJavascriptInclude

 /// <summary>
 /// Registers the javascript include needed for reporting client controls
 /// </summary>
 /// <param name="filterField">The filter field.</param>
 public static void RegisterJavascriptInclude( FilterField filterField )
 {
     ScriptManager.RegisterClientScriptInclude( filterField, filterField.GetType(), "reporting-include", filterField.RockBlock().RockPage.ResolveRockUrl( "~/Scripts/Rock/reportingInclude.js", true ) );
 }
开发者ID:,项目名称:,代码行数:8,代码来源:


注:本文中的Rock.Web.UI.Controls.FilterField.RockBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。