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


C# Controls.RockDropDownList类代码示例

本文整理汇总了C#中Rock.Web.UI.Controls.RockDropDownList的典型用法代码示例。如果您正苦于以下问题:C# RockDropDownList类的具体用法?C# RockDropDownList怎么用?C# RockDropDownList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RockDropDownList类属于Rock.Web.UI.Controls命名空间,在下文中一共展示了RockDropDownList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfigurationControls

        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            List<Control> controls = new List<Control>();

            var ddlMode = new RockDropDownList();
            controls.Add( ddlMode );
            ddlMode.BindToEnum<CodeEditorMode>();
            ddlMode.AutoPostBack = true;
            ddlMode.SelectedIndexChanged += OnQualifierUpdated;
            ddlMode.Label = "Editor Mode";
            ddlMode.Help = "The type of code that will be entered.";

            var ddlTheme = new RockDropDownList();
            controls.Add( ddlTheme );
            ddlTheme.BindToEnum<CodeEditorTheme>();
            ddlTheme.AutoPostBack = true;
            ddlTheme.SelectedIndexChanged += OnQualifierUpdated;
            ddlTheme.Label = "Editor Theme";
            ddlTheme.Help = "The styling them to use for the code editor.";

            var nbHeight = new NumberBox();
            controls.Add( nbHeight );
            nbHeight.NumberType = System.Web.UI.WebControls.ValidationDataType.Integer;
            nbHeight.AutoPostBack = true;
            nbHeight.TextChanged += OnQualifierUpdated;
            nbHeight.Label = "Editor Height";
            nbHeight.Help = "The height of the control in pixels.";

            return controls;
        }
开发者ID:azturner,项目名称:Rock,代码行数:34,代码来源:CodeEditorFieldType.cs

示例2: CreateChildControls

        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls( Type entityType, FilterField filterControl )
        {
            var ddlGroupType = new RockDropDownList();
            ddlGroupType.ID = filterControl.ID + "_0";
            filterControl.Controls.Add( ddlGroupType );

            foreach ( Rock.Model.GroupType groupType in new GroupTypeService( new RockContext() ).Queryable() )
            {
                ddlGroupType.Items.Add( new ListItem( groupType.Name, groupType.Guid.ToString() ) );
            }

            var ddl = ComparisonControl( NumericFilterComparisonTypes );
            ddl.ID = filterControl.ID + "_1";
            filterControl.Controls.Add( ddl );

            var tb = new RockTextBox();
            tb.ID = filterControl.ID + "_2";
            filterControl.Controls.Add( tb );

            var tb2 = new RockTextBox();
            tb2.ID = filterControl.ID + "_3";
            filterControl.Controls.Add( tb );

            var controls = new Control[4] { ddlGroupType, ddl, tb, tb2 };

            SetSelection(
                entityType,
                controls,
                string.Format( "{0}|{1}|4|16", ddlGroupType.Items.Count > 0 ? ddlGroupType.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString() ) );

            return controls;
        }
开发者ID:Ganon11,项目名称:Rock,代码行数:36,代码来源:GroupTypeAttendanceFilter.cs

示例3: ConfigurationControls

        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            List<Control> controls = new List<Control>();

            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.Items.Add( new ListItem( None.Text, None.IdValue ) );
            foreach ( var entityType in new EntityTypeService( new RockContext() ).GetEntities().OrderBy( e => e.FriendlyName ).ThenBy( e => e.Name ) )
            {
                ddl.Items.Add( new ListItem( entityType.FriendlyName, entityType.Name ) );
            }
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Entity Type";
            ddl.Help = "The type of entity to display categories for.";

            var tbColumn = new RockTextBox();
            controls.Add( tbColumn );
            tbColumn.AutoPostBack = true;
            tbColumn.TextChanged += OnQualifierUpdated;
            tbColumn.Label = "Qualifier Column";
            tbColumn.Help = "Entity column qualifier.";

            var tbValue = new RockTextBox();
            controls.Add( tbValue );
            tbValue.AutoPostBack = true;
            tbValue.TextChanged += OnQualifierUpdated;
            tbValue.Label = "Qualifier Value";
            tbValue.Help = "Entity column value.";

            return controls;
        }
开发者ID:azturner,项目名称:Rock,代码行数:36,代码来源:NoteTypeFieldType.cs

示例4: EditControl

        /// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
        {
            var editControl = new RockDropDownList { ID = id };
            editControl.Items.Add( new ListItem() );

            var statuses = new ConnectionStatusService( new RockContext() )
                .Queryable().AsNoTracking()
                .OrderBy( s => s.ConnectionType.Name )
                .ThenBy( s => s.Name )
                .Select( s => new
                {
                    s.Guid,
                    s.Name,
                    ConnectionTypeName = s.ConnectionType.Name
                } )
                .ToList();

            if ( statuses.Any() )
            {
                foreach ( var status in statuses )
                {
                    var listItem = new ListItem( status.Name, status.Guid.ToString().ToUpper() );
                    listItem.Attributes.Add( "OptionGroup", status.ConnectionTypeName );
                    editControl.Items.Add( listItem );
                }

                return editControl;
            }

            return null;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:39,代码来源:ConnectionStatusFieldType.cs

示例5: EditControl

        /// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
        {
            var editControl = new RockDropDownList { ID = id };
            editControl.Items.Add( new ListItem() );

            var types = new ConnectionTypeService( new RockContext() )
                .Queryable().AsNoTracking()
                .OrderBy( o => o.Name )
                .Select( o => new
                {
                    o.Guid,
                    o.Name,
                } )
                .ToList();

            if ( types.Any() )
            {
                foreach ( var type in types )
                {
                    var listItem = new ListItem( type.Name, type.Guid.ToString().ToUpper() );
                    editControl.Items.Add( listItem );
                }

                return editControl;
            }

            return null;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:36,代码来源:ConnectionTypeFieldType.cs

示例6: CreateChildControls

        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls( Type entityType, FilterField filterControl )
        {
            RockDropDownList groupLocationTypeList = new RockDropDownList();
            groupLocationTypeList.Items.Clear();
            foreach ( var value in Rock.Web.Cache.DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.GROUP_LOCATION_TYPE.AsGuid() ).DefinedValues.OrderBy( a => a.Order ).ThenBy( a => a.Value ) )
            {
                groupLocationTypeList.Items.Add( new ListItem( value.Value, value.Guid.ToString() ) );
            }

            groupLocationTypeList.Items.Insert( 0, Rock.Constants.None.ListItem );

            groupLocationTypeList.ID = filterControl.ID + "_groupLocationTypeList";
            groupLocationTypeList.Label = "Location Type";
            filterControl.Controls.Add( groupLocationTypeList );

            LocationPicker locationPicker = new LocationPicker();
            locationPicker.ID = filterControl.ID + "_locationPicker";
            locationPicker.Label = "Location";

            filterControl.Controls.Add( locationPicker );

            NumberBox numberBox = new NumberBox();
            numberBox.ID = filterControl.ID + "_numberBox";
            numberBox.NumberType = ValidationDataType.Double;
            numberBox.Label = "Miles";
            numberBox.AddCssClass( "number-box-miles" );
            filterControl.Controls.Add( numberBox );

            return new Control[3] { groupLocationTypeList, locationPicker, numberBox };
        }
开发者ID:azturner,项目名称:Rock,代码行数:34,代码来源:DistanceFromFilter.cs

示例7: ConfigurationControls

        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            var tbValuePrompt = new RockTextBox();
            controls.Add( tbValuePrompt );
            tbValuePrompt.AutoPostBack = true;
            tbValuePrompt.TextChanged += OnQualifierUpdated;
            tbValuePrompt.Label = "Label Prompt";
            tbValuePrompt.Help = "The text to display as a prompt in the label textbox.";

            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.DataTextField = "Name";
            ddl.DataValueField = "Id";
            ddl.DataSource = new Rock.Model.DefinedTypeService( new RockContext() ).Queryable().OrderBy( d => d.Order ).ToList();
            ddl.DataBind();
            ddl.Items.Insert(0, new ListItem(string.Empty, string.Empty));
            ddl.Label = "Defined Type";
            ddl.Help = "Optional Defined Type to select values from, otherwise values will be free-form text fields.";

            var tbCustomValues = new RockTextBox();
            controls.Add( tbCustomValues );
            tbCustomValues.TextMode = TextBoxMode.MultiLine;
            tbCustomValues.Rows = 3;
            tbCustomValues.AutoPostBack = true;
            tbCustomValues.TextChanged += OnQualifierUpdated;
            tbCustomValues.Label = "Custom Values";
            tbCustomValues.Help = "Optional list of options to use for the values.  Format is either 'value1,value2,value3,...', or 'value1:text1,value2:text2,value3:text3,...'.";

            return controls;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:38,代码来源:ValueListFieldType.cs

示例8: ConfigurationControls

        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of defined types (the one that gets selected is
            // used to build a list of defined values) 
            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Defined Type";
            ddl.Help = "The Defined Type to select values from.";

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService( new RockContext() );
            ddl.Items.Add( new ListItem() );
            foreach ( var definedType in definedTypeService.Queryable().OrderBy( d => d.Name ) )
            {
                ddl.Items.Add( new ListItem( definedType.Name, definedType.Guid.ToString() ) );
            }

            // option to show descriptions instead of values
            var cbDescription = new RockCheckBox();
            controls.Add( cbDescription );
            cbDescription.AutoPostBack = true;
            cbDescription.CheckedChanged += OnQualifierUpdated;
            cbDescription.Label = "Display Descriptions";
            cbDescription.Text = "Yes";
            cbDescription.Help = "When set, the defined value descriptions will be displayed instead of the values.";
            return controls;
        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:34,代码来源:DefinedValueRangeFieldType.cs

示例9: ConfigurationControls

        /// <summary>
        /// Creates the HTML controls required to configure this type of field
        /// </summary>
        /// <returns></returns>
        public override List<Control> ConfigurationControls()
        {
            var controls = base.ConfigurationControls();

            // build a drop down list of workflow types (the one that gets selected is
            // used to build a list of workflow activity types)
            var ddl = new RockDropDownList();
            controls.Add( ddl );
            ddl.AutoPostBack = true;
            ddl.SelectedIndexChanged += OnQualifierUpdated;
            ddl.Label = "Workflow Type";
            ddl.Help = "The Workflow Type to select activities from.";
            var originalValue = ddl.SelectedValue;

            Rock.Model.WorkflowTypeService workflowTypeService = new Model.WorkflowTypeService( new RockContext() );
            foreach ( var workflowType in workflowTypeService.Queryable().OrderBy( w => w.Name ) )
            {
                ddl.Items.Add( new ListItem( workflowType.Name, workflowType.Guid.ToString() ) );
            }

            var httpContext = System.Web.HttpContext.Current;
            if ( string.IsNullOrEmpty(originalValue) && httpContext != null && httpContext.Request != null && httpContext.Request.Params["workflowTypeId"] != null && httpContext.Request.Params["workflowTypeId"].AsIntegerOrNull() == 0 )
            {

                var workflowType = GetContextWorkflowType();
                ddl.Items.Add( new ListItem( ( string.IsNullOrWhiteSpace( workflowType.Name ) ? "Current Workflow" : workflowType.Name ), "" ) );
                ddl.SelectedIndex = ddl.Items.Count - 1;
            }
            return controls;
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:34,代码来源:WorkflowActivityTypeFieldType.cs

示例10: CreateChildControls

        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls( Type entityType, FilterField filterControl )
        {
            var ddlGroupType = new RockDropDownList();
            ddlGroupType.ID = filterControl.ID + "_0";
            filterControl.Controls.Add( ddlGroupType );

            foreach ( Rock.Model.GroupType groupType in new GroupTypeService( new RockContext() ).Queryable() )
            {
                ddlGroupType.Items.Add( new ListItem( groupType.Name, groupType.Guid.ToString() ) );
            }

            var ddlIntegerCompare = ComparisonHelper.ComparisonControl( ComparisonHelper.NumericFilterComparisonTypes );
            ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare";
            filterControl.Controls.Add( ddlIntegerCompare );

            var tbAttendedCount = new RockTextBox();
            tbAttendedCount.ID = filterControl.ID + "_2";
            filterControl.Controls.Add( tbAttendedCount );

            var tbInLastWeeksCount = new RockTextBox();
            tbInLastWeeksCount.ID = filterControl.ID + "_tbInLastWeeksCount";
            filterControl.Controls.Add( tbInLastWeeksCount );

            var controls = new Control[4] { ddlGroupType, ddlIntegerCompare, tbAttendedCount, tbInLastWeeksCount };

            // set the default values in case this is a newly added filter
            SetSelection(
                entityType,
                controls,
                string.Format( "{0}|{1}|4|16", ddlGroupType.Items.Count > 0 ? ddlGroupType.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString() ) );

            return controls;
        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:37,代码来源:GroupTypeAttendanceFilter.cs

示例11: EditControl

        /// <summary>
        /// Creates the control(s) neccessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
        {
            var editControl = new RockDropDownList { ID = id }; 

            Rock.Model.DefinedTypeService definedTypeService = new Model.DefinedTypeService();
            foreach ( var definedType in definedTypeService.Queryable().OrderBy( d => d.Order ) )
                editControl.Items.Add( new ListItem( definedType.Name, definedType.Guid.ToString() ) );

            return editControl;
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:18,代码来源:DefinedTypeFieldType.cs

示例12: EditControl

        /// <summary>
        /// Creates the control(s) necessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
        {
            var ddl = new RockDropDownList { ID = id };
            foreach ( ComparisonType comparisonType in Enum.GetValues( typeof( ComparisonType ) ) )
            {
                ddl.Items.Add( new ListItem( comparisonType.ConvertToString(), comparisonType.ConvertToInt().ToString() ) );
            }

            return ddl;
        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:18,代码来源:ComparisonFieldType.cs

示例13: EditControl

        /// <summary>
        /// Creates the control(s) neccessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl(Dictionary<string,ConfigurationValue> configurationValues, string id)
        {
            var editControl = new RockDropDownList { ID = id }; 

            var service = new EmailTemplateService();
            foreach ( var emailTemplate in service.Queryable().OrderBy( e => e.Title ) )
            {
                editControl.Items.Add( new ListItem( emailTemplate.Title, emailTemplate.Guid.ToString() ) );
            }

            return editControl;
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:20,代码来源:EmailTemplateFieldType.cs

示例14: EditControl

        /// <summary>
        /// Renders the controls neccessary for prompting user for a new value and adds them to the parentControl
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
        {
            var ddl = new RockDropDownList { ID = id }; 

            Type colors = typeof( System.Drawing.Color );
            PropertyInfo[] colorInfo = colors.GetProperties( BindingFlags.Public | BindingFlags.Static );
            foreach ( PropertyInfo info in colorInfo )
            {
                ddl.Items.Add( new ListItem( info.Name, info.Name ) );
            }

            return ddl;
        }
开发者ID:Ganon11,项目名称:Rock,代码行数:21,代码来源:ColorFieldType.cs

示例15: EditControl

        /// <summary>
        /// Creates the control(s) neccessary for prompting user for a new value
        /// </summary>
        /// <param name="configurationValues">The configuration values.</param>
        /// <param name="id"></param>
        /// <returns>
        /// The control
        /// </returns>
        public override System.Web.UI.Control EditControl( Dictionary<string, ConfigurationValue> configurationValues, string id )
        {
            var editControl = new RockDropDownList { ID = id }; 

            CampusService campusService = new CampusService();
            var campusList = campusService.Queryable().OrderBy( a => a.Name ).ToList();
            editControl.Items.Add( None.ListItem );
            foreach ( var campus in campusList )
            {
                editControl.Items.Add( new ListItem( campus.Name, campus.Id.ToString() ) );
            }

            return editControl;
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:22,代码来源:CampusFieldType.cs


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