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


C# RockDropDownList.SelectedValueAsId方法代码示例

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


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

示例1: CreateChildControls

        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <returns></returns>
        public override Control[] CreateChildControls( Type entityType, FilterField filterControl )
        {
            var controls = new List<Control>();

            // Add the registration template picker
            int? selectedTemplateId = null;
            if ( _ddlRegistrationTemplate != null )
            {
                selectedTemplateId = _ddlRegistrationTemplate.SelectedValueAsId();
            }

            _ddlRegistrationTemplate = new RockDropDownList();
            _ddlRegistrationTemplate.CssClass = "js-registration-template";
            _ddlRegistrationTemplate.ID = filterControl.ID + "_ddlRegistrationTemplate";
            _ddlRegistrationTemplate.Label = "Registration Template";
            _ddlRegistrationTemplate.DataTextField = "Name";
            _ddlRegistrationTemplate.DataValueField = "Id";
            _ddlRegistrationTemplate.DataSource = new RegistrationTemplateService( new RockContext() ).Queryable()
                .OrderBy( a => a.Name )
                .Select( d => new
                {
                    d.Id,
                    d.Name
                } )
            .ToList();
            _ddlRegistrationTemplate.DataBind();
            _ddlRegistrationTemplate.SelectedIndexChanged += ddlRegistrationTemplate_SelectedIndexChanged;
            _ddlRegistrationTemplate.AutoPostBack = true;
            _ddlRegistrationTemplate.SelectedValue = selectedTemplateId.ToStringSafe();
            filterControl.Controls.Add( _ddlRegistrationTemplate );

            // Now add the registration instance picker
            _ddlRegistrationInstance = new RockDropDownList();
            _ddlRegistrationInstance.CssClass = "js-registration-instance";
            _ddlRegistrationInstance.Label = "Registration Instance";
            _ddlRegistrationInstance.ID = filterControl.ID + "_ddlRegistrationInstance";
            filterControl.Controls.Add( _ddlRegistrationInstance );

            PopulateRegistrationInstanceList( _ddlRegistrationTemplate.SelectedValueAsId () ?? 0  );

            _rblRegistrationType = new RockRadioButtonList();
            _rblRegistrationType.CssClass = "js-registration-type";
            _rblRegistrationType.ID = filterControl.ID + "_registrationType";
            _rblRegistrationType.RepeatDirection = RepeatDirection.Horizontal;
            _rblRegistrationType.Label = "Person";
            _rblRegistrationType.Help = "Choose whether to filter by the person who did the registering (registrar) or the person who was registered (registrant).";
            _rblRegistrationType.Items.Add( new ListItem( "Registrar", "1" ) );
            _rblRegistrationType.Items.Add( new ListItem( "Registrant", "2" ) );
            _rblRegistrationType.SelectedValue = "2";
            filterControl.Controls.Add( _rblRegistrationType );

            return new Control[3] { _ddlRegistrationTemplate, _ddlRegistrationInstance, _rblRegistrationType };
        }
开发者ID:NewSpring,项目名称:Rock,代码行数:57,代码来源:InRegistrationInstanceFilter.cs


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