本文整理汇总了C#中Rock.Web.UI.Controls.RockDropDownList.BindToEnum方法的典型用法代码示例。如果您正苦于以下问题:C# RockDropDownList.BindToEnum方法的具体用法?C# RockDropDownList.BindToEnum怎么用?C# RockDropDownList.BindToEnum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Web.UI.Controls.RockDropDownList
的用法示例。
在下文中一共展示了RockDropDownList.BindToEnum方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: CreateChildControls
/// <summary>
/// Creates the model representation of the child controls used to display and edit the filter settings.
/// Implement this version of CreateChildControls if your DataFilterComponent works the same in all filter modes
/// </summary>
/// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
/// <param name="filterControl">The control that serves as the container for the filter controls.</param>
/// <returns>
/// The array of new controls created to implement the filter.
/// </returns>
public override Control[] CreateChildControls( Type entityType, FilterField filterControl )
{
// Define Control: Group Data View Picker
var ddlDataView = new DataViewPicker();
ddlDataView.ID = filterControl.GetChildControlInstanceName( _CtlDataView );
ddlDataView.Label = "Is Member of Group from Data View";
ddlDataView.Help = "A Data View that filters the Groups included in the result. If no value is selected, any Groups that would be visible in a Group List will be included.";
filterControl.Controls.Add( ddlDataView );
// Define Control: Group Member Status DropDown List
var ddlGroupMemberStatus = new RockDropDownList();
ddlGroupMemberStatus.CssClass = "js-group-member-status";
ddlGroupMemberStatus.ID = filterControl.GetChildControlInstanceName( _CtlGroupStatus );
ddlGroupMemberStatus.Label = "with Group Member Status";
ddlGroupMemberStatus.Help = "Specifies the Status the Member must have to be included in the result. If no value is selected, Members of every Group Status will be shown.";
ddlGroupMemberStatus.BindToEnum<GroupMemberStatus>( true );
ddlGroupMemberStatus.SetValue( GroupMemberStatus.Active.ConvertToInt() );
filterControl.Controls.Add( ddlGroupMemberStatus );
// Define Control: Role Type DropDown List
var ddlRoleType = new RockDropDownList();
ddlRoleType.ID = filterControl.GetChildControlInstanceName( _CtlRoleType );
ddlRoleType.Label = "with Group Role Type";
ddlRoleType.Help = "Specifies the type of Group Role the Member must have to be included in the result. If no value is selected, Members in every Role will be shown.";
ddlRoleType.Items.Add( new ListItem( string.Empty, RoleTypeSpecifier.Any.ToString() ) );
ddlRoleType.Items.Add( new ListItem( "Leader", RoleTypeSpecifier.Leader.ToString() ) );
ddlRoleType.Items.Add( new ListItem( "Member", RoleTypeSpecifier.Member.ToString() ) );
filterControl.Controls.Add( ddlRoleType );
// Populate the Data View Picker
int entityTypeId = EntityTypeCache.Read( typeof( Model.Group ) ).Id;
ddlDataView.EntityTypeId = entityTypeId;
return new Control[] { ddlDataView, ddlGroupMemberStatus, ddlRoleType };
}
示例3: CreateChildControls
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
Controls.Clear();
_hfExpanded = new HiddenFieldWithClass();
Controls.Add( _hfExpanded );
_hfExpanded.ID = this.ID + "_hfExpanded";
_hfExpanded.CssClass = "filter-expanded";
_hfExpanded.Value = "False";
_hfActionTypeGuid = new HiddenField();
Controls.Add( _hfActionTypeGuid );
_hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid";
_lblActionTypeName = new Label();
Controls.Add( _lblActionTypeName );
_lblActionTypeName.ClientIDMode = ClientIDMode.Static;
_lblActionTypeName.ID = this.ID + "_lblActionTypeName";
_lbDeleteActionType = new LinkButton();
Controls.Add( _lbDeleteActionType );
_lbDeleteActionType.CausesValidation = false;
_lbDeleteActionType.ID = this.ID + "_lbDeleteActionType";
_lbDeleteActionType.CssClass = "btn btn-xs btn-danger js-action-delete";
_lbDeleteActionType.Click += lbDeleteActionType_Click;
var iDelete = new HtmlGenericControl( "i" );
_lbDeleteActionType.Controls.Add( iDelete );
iDelete.AddCssClass( "fa fa-times" );
_ddlCriteriaAttribute = new RockDropDownList();
Controls.Add( _ddlCriteriaAttribute );
_ddlCriteriaAttribute.ID = this.ID + "_ddlCriteriaAttribute";
_ddlCriteriaAttribute.CssClass = "js-conditional-run-criteria";
_ddlCriteriaAttribute.Label = "Run If";
_ddlCriteriaAttribute.Help = "Optional criteria to prevent the action from running. If the criteria is not met, this action will be skipped when this activity is processed.";
_ddlCriteriaComparisonType = new RockDropDownList();
Controls.Add( _ddlCriteriaComparisonType );
_ddlCriteriaComparisonType.ID = this.ID + "_ddlCriteriaComparisonType";
_ddlCriteriaComparisonType.CssClass = "js-action-criteria-comparison";
_ddlCriteriaComparisonType.BindToEnum<ComparisonType>();
_ddlCriteriaComparisonType.Label = " ";
_tbddlCriteriaValue = new RockTextOrDropDownList();
Controls.Add( _tbddlCriteriaValue );
_tbddlCriteriaValue.ID = this.ID + "_tbddlCriteriaValue";
_tbddlCriteriaValue.TextBox.Label = "Text Value";
_tbddlCriteriaValue.DropDownList.Label = "Attribute Value";
_tbActionTypeName = new RockTextBox();
Controls.Add( _tbActionTypeName );
_tbActionTypeName.ID = this.ID + "_tbActionTypeName";
_tbActionTypeName.Label = "Name";
_tbActionTypeName.Required = true;
_tbActionTypeName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID );
_ddlEntityType = new RockDropDownList();
Controls.Add( _ddlEntityType );
_ddlEntityType.ID = this.ID + "_ddlEntityType";
_ddlEntityType.Label = "Action Type";
// make it autopostback since Attributes are dependant on which EntityType is selected
_ddlEntityType.AutoPostBack = true;
_ddlEntityType.SelectedIndexChanged += ddlEntityType_SelectedIndexChanged;
foreach ( var item in ActionContainer.Instance.Components.Values.OrderBy( a => a.Value.EntityType.FriendlyName ) )
{
var type = item.Value.GetType();
if (type != null)
{
var entityType = EntityTypeCache.Read( type );
var li = new ListItem( entityType.FriendlyName, entityType.Id.ToString() );
// Get description
string description = string.Empty;
var descAttributes = type.GetCustomAttributes( typeof( System.ComponentModel.DescriptionAttribute ), false );
if ( descAttributes != null )
{
foreach ( System.ComponentModel.DescriptionAttribute descAttribute in descAttributes )
{
description = descAttribute.Description;
}
}
if ( !string.IsNullOrWhiteSpace( description ) )
{
li.Attributes.Add( "title", description );
}
_ddlEntityType.Items.Add( li );
}
}
_cbIsActionCompletedOnSuccess = new RockCheckBox { Text = "Action is Completed on Success" };
Controls.Add( _cbIsActionCompletedOnSuccess );
_cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess";
//.........这里部分代码省略.........
示例4: CreateChildControls
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
Controls.Clear();
_hfExpanded = new HiddenFieldWithClass();
Controls.Add( _hfExpanded );
_hfExpanded.ID = this.ID + "_hfExpanded";
_hfExpanded.CssClass = "filter-expanded";
_hfExpanded.Value = "False";
_hfActionTypeGuid = new HiddenField();
Controls.Add( _hfActionTypeGuid );
_hfActionTypeGuid.ID = this.ID + "_hfActionTypeGuid";
_lblActionTypeName = new Label();
Controls.Add( _lblActionTypeName );
_lblActionTypeName.ClientIDMode = ClientIDMode.Static;
_lblActionTypeName.ID = this.ID + "_lblActionTypeName";
_lbDeleteActionType = new LinkButton();
Controls.Add( _lbDeleteActionType );
_lbDeleteActionType.CausesValidation = false;
_lbDeleteActionType.ID = this.ID + "_lbDeleteActionType";
_lbDeleteActionType.CssClass = "btn btn-xs btn-danger js-action-delete";
_lbDeleteActionType.Click += lbDeleteActionType_Click;
var iDelete = new HtmlGenericControl( "i" );
_lbDeleteActionType.Controls.Add( iDelete );
iDelete.AddCssClass( "fa fa-times" );
_ddlCriteriaAttribute = new RockDropDownList();
Controls.Add( _ddlCriteriaAttribute );
_ddlCriteriaAttribute.ID = this.ID + "_ddlCriteriaAttribute";
_ddlCriteriaAttribute.EnableViewState = false;
_ddlCriteriaAttribute.CssClass = "js-conditional-run-criteria";
_ddlCriteriaAttribute.Label = "Run If";
_ddlCriteriaAttribute.Help = "Optional criteria to prevent the action from running. If the criteria is not met, this action will be skipped when this activity is processed.";
_ddlCriteriaComparisonType = new RockDropDownList();
Controls.Add( _ddlCriteriaComparisonType );
_ddlCriteriaComparisonType.ID = this.ID + "_ddlCriteriaComparisonType";
_ddlCriteriaComparisonType.EnableViewState = false;
_ddlCriteriaComparisonType.CssClass = "js-action-criteria-comparison";
_ddlCriteriaComparisonType.BindToEnum<ComparisonType>();
_ddlCriteriaComparisonType.Label = " ";
_tbddlCriteriaValue = new RockTextOrDropDownList();
Controls.Add( _tbddlCriteriaValue );
_tbddlCriteriaValue.ID = this.ID + "_tbddlCriteriaValue";
_tbddlCriteriaValue.EnableViewState = false;
_tbddlCriteriaValue.TextBox.Label = "Text Value";
_tbddlCriteriaValue.DropDownList.Label = "Attribute Value";
_tbActionTypeName = new RockTextBox();
Controls.Add( _tbActionTypeName );
_tbActionTypeName.ID = this.ID + "_tbActionTypeName";
_tbActionTypeName.Label = "Name";
_tbActionTypeName.Required = true;
_tbActionTypeName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblActionTypeName.ID );
_wfatpEntityType = new WorkflowActionTypePicker();
_wfatpEntityType.SelectItem += wfatpEntityType_SelectItem;
Controls.Add( _wfatpEntityType );
_wfatpEntityType.ID = this.ID + "_wfatpEntityType";
_wfatpEntityType.Label = "Action Type";
_rlEntityTypeOverview = new RockLiteral();
Controls.Add( _rlEntityTypeOverview );
_rlEntityTypeOverview.ID = this.ID + "";
_rlEntityTypeOverview.Label = "Action Type Overview";
_cbIsActionCompletedOnSuccess = new RockCheckBox { Text = "Action is Completed on Success" };
Controls.Add( _cbIsActionCompletedOnSuccess );
_cbIsActionCompletedOnSuccess.ID = this.ID + "_cbIsActionCompletedOnSuccess";
_cbIsActivityCompletedOnSuccess = new RockCheckBox { Text = "Activity is Completed on Success" };
Controls.Add( _cbIsActivityCompletedOnSuccess );
_cbIsActivityCompletedOnSuccess.ID = this.ID + "_cbIsActivityCompletedOnSuccess";
_formEditor = new WorkflowFormEditor();
Controls.Add( _formEditor );
_formEditor.ID = this.ID + "_formEditor";
_phActionAttributes = new PlaceHolder();
Controls.Add( _phActionAttributes );
_phActionAttributes.ID = this.ID + "_phActionAttributes";
}
示例5: CreateChildControls
/// <summary>
/// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
/// </summary>
protected override void CreateChildControls()
{
Controls.Clear();
_lblGroupTypeName = new Label();
_lblGroupTypeName.ClientIDMode = ClientIDMode.Static;
_lblGroupTypeName.ID = this.ID + "_lblGroupTypeName";
_tbGroupTypeName = new DataTextBox();
_tbGroupTypeName.ID = this.ID + "_tbGroupTypeName";
_tbGroupTypeName.Label = "Check-in Area Name";
// set label when they exit the edit field
_tbGroupTypeName.Attributes["onblur"] = string.Format( "javascript: $('#{0}').text($(this).val());", _lblGroupTypeName.ClientID );
_tbGroupTypeName.SourceTypeName = "Rock.Model.GroupType, Rock";
_tbGroupTypeName.PropertyName = "Name";
_ddlGroupTypeInheritFrom = new RockDropDownList();
_ddlGroupTypeInheritFrom.ID = this.ID + "_ddlGroupTypeInheritFrom";
_ddlGroupTypeInheritFrom.Label = "Inherit from";
_ddlGroupTypeInheritFrom.Items.Add( Rock.Constants.None.ListItem );
var groupTypeCheckinFilterList = new GroupTypeService( new RockContext() ).Queryable()
.Where( a => a.GroupTypePurposeValue.Guid == new Guid( Rock.SystemGuid.DefinedValue.GROUPTYPE_PURPOSE_CHECKIN_FILTER ) )
.OrderBy( a => a.Order ).ThenBy( a => a.Name )
.Select( a => new { a.Id, a.Name } ).ToList();
foreach ( var groupType in groupTypeCheckinFilterList )
{
_ddlGroupTypeInheritFrom.Items.Add( new ListItem( groupType.Name, groupType.Id.ToString() ) );
}
_ddlGroupTypeInheritFrom.AutoPostBack = true;
_ddlGroupTypeInheritFrom.SelectedIndexChanged += _ddlGroupTypeInheritFrom_SelectedIndexChanged;
_ddlAttendanceRule = new RockDropDownList();
_ddlAttendanceRule.ID = this.ID + "_ddlAttendanceRule";
_ddlAttendanceRule.Label = "Check-in Rule";
_ddlAttendanceRule.Help = "The rule that check in should use when a person attempts to check in to a group of this type. If 'None' is selected, user will not be added to group and is not required to belong to group. If 'Add On Check In' is selected, user will be added to group if they don't already belong. If 'Already Belongs' is selected, user must already be a member of the group or they will not be allowed to check in.";
_ddlAttendanceRule.BindToEnum<Rock.Model.AttendanceRule>();
_ddlPrintTo = new RockDropDownList();
_ddlPrintTo.ID = this.ID + "_ddlPrintTo";
_ddlPrintTo.Label = "Print To";
_ddlPrintTo.Help = "When printing check-in labels, should the device's printer or the location's printer be used? Note: the device has a similar setting which takes precedence over this setting.";
_ddlPrintTo.Items.Add( new ListItem( "Device Printer", "1" ) );
_ddlPrintTo.Items.Add( new ListItem( "Location Printer", "2" ) );
_phGroupTypeAttributes = new PlaceHolder();
_phGroupTypeAttributes.ID = this.ID + "_phGroupTypeAttributes";
Controls.Add( _lblGroupTypeName );
Controls.Add( _ddlGroupTypeInheritFrom );
Controls.Add( _ddlAttendanceRule );
Controls.Add( _ddlPrintTo );
Controls.Add( _tbGroupTypeName );
Controls.Add( _phGroupTypeAttributes );
// Check-in Labels grid
CreateCheckinLabelsGrid();
}
示例6: CreateChildControls
/// <summary>
/// Creates the child controls.
/// </summary>
/// <returns></returns>
public override Control[] CreateChildControls( Type entityType, FilterField filterControl )
{
gp = new GroupPicker();
gp.ID = filterControl.ID + "_gp";
gp.Label = "Group(s)";
gp.SelectItem += gp_SelectItem;
gp.CssClass = "js-group-picker";
gp.AllowMultiSelect = true;
filterControl.Controls.Add( gp );
cbChildGroups = new RockCheckBox();
cbChildGroups.ID = filterControl.ID + "_cbChildsGroups";
cbChildGroups.Text = "Include Child Group(s)";
cbChildGroups.CssClass = "js-include-child-groups";
cbChildGroups.AutoPostBack = true;
cbChildGroups.CheckedChanged += gp_SelectItem;
filterControl.Controls.Add( cbChildGroups );
cbIncludeSelectedGroup = new RockCheckBox();
cbIncludeSelectedGroup.ID = filterControl.ID + "_cbIncludeSelectedGroup";
cbIncludeSelectedGroup.Text = "Include Selected Group(s)";
cbIncludeSelectedGroup.CssClass = "js-include-selected-groups";
cbIncludeSelectedGroup.AutoPostBack = true;
cbIncludeSelectedGroup.CheckedChanged += gp_SelectItem;
filterControl.Controls.Add( cbIncludeSelectedGroup );
cbChildGroupsPlusDescendants = new RockCheckBox();
cbChildGroupsPlusDescendants.ID = filterControl.ID + "_cbChildGroupsPlusDescendants";
cbChildGroupsPlusDescendants.Text = "Include All Descendants(s)";
cbChildGroupsPlusDescendants.CssClass = "js-include-child-groups-descendants";
cbChildGroupsPlusDescendants.AutoPostBack = true;
cbChildGroupsPlusDescendants.CheckedChanged += gp_SelectItem;
filterControl.Controls.Add( cbChildGroupsPlusDescendants );
cbIncludeInactiveGroups = new RockCheckBox();
cbIncludeInactiveGroups.ID = filterControl.ID + "_cbIncludeInactiveGroups";
cbIncludeInactiveGroups.Text = "Include Inactive Groups";
cbIncludeInactiveGroups.CssClass = "js-include-inactive-groups";
cbIncludeInactiveGroups.AutoPostBack = true;
cbIncludeInactiveGroups.CheckedChanged += gp_SelectItem;
filterControl.Controls.Add( cbIncludeInactiveGroups );
cblRole = new RockCheckBoxList();
cblRole.Label = "with Group Member Role(s) (optional)";
cblRole.ID = filterControl.ID + "_cblRole";
cblRole.CssClass = "js-roles";
cblRole.Visible = false;
filterControl.Controls.Add( cblRole );
RockDropDownList ddlGroupMemberStatus = new RockDropDownList();
ddlGroupMemberStatus.CssClass = "js-group-member-status";
ddlGroupMemberStatus.ID = filterControl.ID + "_ddlGroupMemberStatus";
ddlGroupMemberStatus.Label = "with Group Member Status";
ddlGroupMemberStatus.Help = "Select a specific group member status to only include group members with that status. Leaving this blank will return all members.";
ddlGroupMemberStatus.BindToEnum<GroupMemberStatus>( true );
ddlGroupMemberStatus.SetValue( GroupMemberStatus.Active.ConvertToInt() );
filterControl.Controls.Add( ddlGroupMemberStatus );
PanelWidget pwAdvanced = new PanelWidget();
filterControl.Controls.Add( pwAdvanced );
pwAdvanced.ID = filterControl.ID + "_pwAttributes";
pwAdvanced.Title = "Advanced Filters";
pwAdvanced.CssClass = "advanced-panel";
SlidingDateRangePicker addedOnDateRangePicker = new SlidingDateRangePicker();
addedOnDateRangePicker.ID = pwAdvanced.ID + "_addedOnDateRangePicker";
addedOnDateRangePicker.AddCssClass( "js-sliding-date-range" );
addedOnDateRangePicker.Label = "Date Added:";
addedOnDateRangePicker.Help = "Select the date range that the person was added to the group. Leaving this blank will not restrict results to a date range.";
pwAdvanced.Controls.Add( addedOnDateRangePicker );
return new Control[9] { gp, cbChildGroups, cbIncludeSelectedGroup, cbChildGroupsPlusDescendants, cblRole, ddlGroupMemberStatus, cbIncludeInactiveGroups, addedOnDateRangePicker, pwAdvanced };
}
示例7: CreateChildControls
/// <summary>
/// Creates the child controls.
/// </summary>
/// <param name="parentControl"></param>
/// <returns></returns>
public override System.Web.UI.Control[] CreateChildControls( System.Web.UI.Control parentControl )
{
RockRadioButtonList rblShowAsLinkType = new RockRadioButtonList();
rblShowAsLinkType.ID = parentControl.ID + "_rblShowAsLinkType";
rblShowAsLinkType.Items.Add( new ListItem( "Show Name Only", ShowAsLinkType.NameOnly.ConvertToInt().ToString() ) );
rblShowAsLinkType.Items.Add( new ListItem( "Show as Person Link", ShowAsLinkType.PersonLink.ConvertToInt().ToString() ) );
rblShowAsLinkType.Items.Add( new ListItem( "Show as Group Member Link", ShowAsLinkType.GroupMemberLink.ConvertToInt().ToString() ) );
parentControl.Controls.Add( rblShowAsLinkType );
int? selectedGroupTypeId = null;
if ( groupTypePicker != null )
{
selectedGroupTypeId = groupTypePicker.SelectedGroupTypeId;
}
groupTypePicker = new GroupTypePicker();
groupTypePicker.ID = parentControl.ID + "_groupTypePicker";
groupTypePicker.Label = "Group Type";
groupTypePicker.GroupTypes = new GroupTypeService( new RockContext() ).Queryable().OrderBy( a => a.Order ).ThenBy( a => a.Name ).ToList();
groupTypePicker.SelectedIndexChanged += groupTypePicker_SelectedIndexChanged;
groupTypePicker.AutoPostBack = true;
groupTypePicker.SelectedGroupTypeId = selectedGroupTypeId;
parentControl.Controls.Add( groupTypePicker );
cblRole = new RockCheckBoxList();
cblRole.Label = "with Group Role(s)";
cblRole.ID = parentControl.ID + "_cblRole";
parentControl.Controls.Add( cblRole );
PopulateGroupRolesCheckList( groupTypePicker.SelectedGroupTypeId ?? 0 );
RockDropDownList ddlGroupMemberStatus = new RockDropDownList();
ddlGroupMemberStatus.CssClass = "js-group-member-status";
ddlGroupMemberStatus.ID = parentControl.ID + "_ddlGroupMemberStatus";
ddlGroupMemberStatus.Label = "with Group Member Status";
ddlGroupMemberStatus.Help = "Select a specific group member status to only include group members with that status. Leaving this blank will return all members.";
ddlGroupMemberStatus.BindToEnum<GroupMemberStatus>( true );
ddlGroupMemberStatus.SetValue( GroupMemberStatus.Active.ConvertToInt() );
parentControl.Controls.Add( ddlGroupMemberStatus );
return new System.Web.UI.Control[] { rblShowAsLinkType, groupTypePicker, cblRole, ddlGroupMemberStatus };
}
示例8: AddDynamicControls
//.........这里部分代码省略.........
gpGradeFilter2.ID = "gpGradeFilter";
gpGradeFilter2.Label = "Grade";
gpGradeFilter2.UseAbbreviation = true;
gpGradeFilter2.UseGradeOffsetAsValue = true;
gpGradeFilter2.CssClass = "input-width-md";
gpGradeFilter2.SetValue( fRegistrants.GetUserPreference( "WL-Grade" ).AsIntegerOrNull() );
phWaitListFormFieldFilters.Controls.Add( gpGradeFilter2 );
string dataFieldExpression = "PersonAlias.Person.GraduationYear";
var gradeField = new RockBoundField();
gradeField.DataField = dataFieldExpression;
gradeField.HeaderText = "Graduation Year";
gradeField.SortExpression = dataFieldExpression;
gRegistrants.Columns.Add( gradeField );
var gradeField2 = new RockBoundField();
gradeField2.DataField = dataFieldExpression;
gradeField2.HeaderText = "Graduation Year";
gradeField2.SortExpression = dataFieldExpression;
gGroupPlacements.Columns.Add( gradeField2 );
var gradeField3 = new RockBoundField();
gradeField3.DataField = dataFieldExpression;
gradeField3.HeaderText = "Graduation Year";
gradeField3.SortExpression = dataFieldExpression;
gWaitList.Columns.Add( gradeField3 );
break;
}
case RegistrationPersonFieldType.Gender:
{
var ddlGenderFilter = new RockDropDownList();
ddlGenderFilter.BindToEnum<Gender>( true );
ddlGenderFilter.ID = "ddlGenderFilter";
ddlGenderFilter.Label = "Gender";
ddlGenderFilter.SetValue( fRegistrants.GetUserPreference( "Gender" ) );
phRegistrantFormFieldFilters.Controls.Add( ddlGenderFilter );
var ddlGenderFilter2 = new RockDropDownList();
ddlGenderFilter2.BindToEnum<Gender>( true );
ddlGenderFilter2.ID = "ddlGenderFilter";
ddlGenderFilter2.Label = "Gender";
ddlGenderFilter2.SetValue( fRegistrants.GetUserPreference( "WL-Gender" ) );
phWaitListFormFieldFilters.Controls.Add( ddlGenderFilter2 );
string dataFieldExpression = "PersonAlias.Person.Gender";
var genderField = new EnumField();
genderField.DataField = dataFieldExpression;
genderField.HeaderText = "Gender";
genderField.SortExpression = dataFieldExpression;
gRegistrants.Columns.Add( genderField );
var genderField2 = new EnumField();
genderField2.DataField = dataFieldExpression;
genderField2.HeaderText = "Gender";
genderField2.SortExpression = dataFieldExpression;
gGroupPlacements.Columns.Add( genderField2 );
var genderField3 = new EnumField();
genderField3.DataField = dataFieldExpression;
genderField3.HeaderText = "Gender";
genderField3.SortExpression = dataFieldExpression;
gWaitList.Columns.Add( genderField3 );
break;
}
示例9: CreateChildControls
/// <summary>
/// Creates the child controls.
/// </summary>
/// <param name="parentControl"></param>
/// <returns></returns>
public override Control[] CreateChildControls( Control parentControl )
{
// Define Control: Output Format DropDown List
var ddlFormat = new RockDropDownList();
ddlFormat.ID = parentControl.GetChildControlInstanceName( _CtlFormat );
ddlFormat.Label = "Output Format";
ddlFormat.Help = "Specifies the content and format of the values in this field.";
ddlFormat.Items.Add( new ListItem( "Group List: Name And Role", ListFormatSpecifier.GroupAndRole.ToString() ) );
ddlFormat.Items.Add( new ListItem( "Group List: Group Name", ListFormatSpecifier.GroupOnly.ToString() ) );
ddlFormat.Items.Add( new ListItem( "Yes/No: Yes if any participation", ListFormatSpecifier.YesNo.ToString() ) );
parentControl.Controls.Add( ddlFormat );
// Define Control: Group Data View Picker
var ddlDataView = new DataViewPicker();
ddlDataView.ID = parentControl.GetChildControlInstanceName( _CtlDataView );
ddlDataView.Label = "Participates in Groups";
ddlDataView.Help = "A Data View that filters the Groups included in the result. If no value is selected, any Groups that would be visible in a Group List will be included.";
parentControl.Controls.Add( ddlDataView );
// Define Control: Role Type DropDown List
var ddlRoleType = new RockDropDownList();
ddlRoleType.ID = parentControl.GetChildControlInstanceName( _CtlRoleType );
ddlRoleType.Label = "with Group Role Type";
ddlRoleType.Help = "Specifies the type of Group Role the Member must have to be included in the result. If no value is selected, Members in any Role will be included.";
ddlRoleType.Items.Add( new ListItem( string.Empty, RoleTypeSpecifier.Any.ToString() ) );
ddlRoleType.Items.Add( new ListItem( "Leader", RoleTypeSpecifier.Leader.ToString() ) );
ddlRoleType.Items.Add( new ListItem( "Member", RoleTypeSpecifier.Member.ToString() ) );
parentControl.Controls.Add( ddlRoleType );
// Define Control: Group Member Status DropDown List
var ddlGroupMemberStatus = new RockDropDownList();
ddlGroupMemberStatus.CssClass = "js-group-member-status";
ddlGroupMemberStatus.ID = parentControl.GetChildControlInstanceName( _CtlGroupStatus );
ddlGroupMemberStatus.Label = "with Group Member Status";
ddlGroupMemberStatus.Help = "Specifies the Status the Member must have to be included in the result. If no value is selected, Members of any Group Status will be shown.";
ddlGroupMemberStatus.BindToEnum<GroupMemberStatus>( true );
ddlGroupMemberStatus.SetValue( GroupMemberStatus.Active.ConvertToInt() );
parentControl.Controls.Add( ddlGroupMemberStatus );
// Populate the Data View Picker
int entityTypeId = EntityTypeCache.Read( typeof( Model.Group ) ).Id;
ddlDataView.EntityTypeId = entityTypeId;
return new Control[] { ddlDataView, ddlRoleType, ddlFormat, ddlGroupMemberStatus };
}
示例10: CreateChildControls
/// <summary>
/// Creates the child controls.
/// </summary>
/// <param name="parentControl"></param>
/// <returns></returns>
public override System.Web.UI.Control[] CreateChildControls( System.Web.UI.Control parentControl )
{
var groupTypePicker = new GroupTypePicker();
groupTypePicker.ID = parentControl.ID + "_groupTypePicker";
groupTypePicker.Label = "Group Type";
groupTypePicker.GroupTypes = new GroupTypeService( new RockContext() ).Queryable().OrderBy( a => a.Order ).ThenBy( a => a.Name ).ToList();
groupTypePicker.SelectedIndexChanged += groupTypePicker_SelectedIndexChanged;
groupTypePicker.AutoPostBack = true;
parentControl.Controls.Add( groupTypePicker );
int? selectedGroupTypeId = parentControl.Page.Request.Params[groupTypePicker.UniqueID].AsIntegerOrNull();
groupTypePicker.SelectedGroupTypeId = selectedGroupTypeId;
var cblRole = new RockCheckBoxList();
cblRole.Label = "with Group Role(s)";
cblRole.ID = parentControl.ID + "_cblRole";
parentControl.Controls.Add( cblRole );
PopulateGroupRolesCheckList( groupTypePicker.SelectedGroupTypeId ?? 0, cblRole );
RockDropDownList ddlGroupMemberStatus = new RockDropDownList();
ddlGroupMemberStatus.CssClass = "js-group-member-status";
ddlGroupMemberStatus.ID = parentControl.ID + "_ddlGroupMemberStatus";
ddlGroupMemberStatus.Label = "with Group Member Status";
ddlGroupMemberStatus.Help = "Select a specific group member status only include to only show true for group members with that status. Leaving this blank will return true for all members.";
ddlGroupMemberStatus.BindToEnum<GroupMemberStatus>( true );
ddlGroupMemberStatus.SetValue( GroupMemberStatus.Active.ConvertToInt() );
parentControl.Controls.Add( ddlGroupMemberStatus );
return new Control[3] { groupTypePicker, cblRole, ddlGroupMemberStatus };
}