本文整理汇总了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 };
}