當前位置: 首頁>>代碼示例>>C#>>正文


C# Control.GetByName方法代碼示例

本文整理匯總了C#中System.Web.UI.Control.GetByName方法的典型用法代碼示例。如果您正苦於以下問題:C# Control.GetByName方法的具體用法?C# Control.GetByName怎麽用?C# Control.GetByName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Web.UI.Control的用法示例。


在下文中一共展示了Control.GetByName方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetSelection

        /// <summary>
        /// Sets the selection.
        /// Implement this version of SetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection( Type entityType, Control[] controls, string selection )
        {
            var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView );
            var ddlRoleType = controls.GetByName<RockDropDownList>( _CtlRoleType );
            var ddlGroupMemberStatus = controls.GetByName<RockDropDownList>( _CtlGroupStatus );

            var settings = new SelectSettings( selection );

            if ( !settings.IsValid )
            {
                return;
            }

            if ( settings.DataViewGuid.HasValue )
            {
                var dsService = new DataViewService( new RockContext() );

                var dataView = dsService.Get( settings.DataViewGuid.Value );

                if ( dataView != null )
                {
                    ddlDataView.SelectedValue = dataView.Id.ToString();
                }
            }

            ddlRoleType.SelectedValue = settings.RoleType.ToStringSafe();
            ddlGroupMemberStatus.SelectedValue = settings.MemberStatus.ToStringSafe();
        }
開發者ID:NewSpring,項目名稱:Rock,代碼行數:35,代碼來源:GroupDataViewFilter.cs

示例2: SetSelection

        /// <summary>
        /// Sets the filter control values from a formatted string.
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <param name="selection">A formatted string representing the filter settings.</param>
        public override void SetSelection( Type entityType, Control[] controls, string selection )
        {
            var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView );
            var ddlCompare = controls.GetByName<RockDropDownList>( _CtlComparison );
            var nbValue = controls.GetByName<NumberBox>( _CtlMemberCount );

            var settings = new FilterSettings( selection );

            if (!settings.IsValid)
            {
                return;
            }

            ddlDataView.SelectedValue = DataComponentSettingsHelper.GetDataViewId( settings.PersonDataViewGuid ).ToStringSafe();
            ddlCompare.SelectedValue = settings.PersonCountComparison.ConvertToInt().ToString();
            nbValue.Text = settings.PersonCount.ToString();
        }
開發者ID:azturner,項目名稱:Rock,代碼行數:23,代碼來源:ContainsPeopleFilter.cs

示例3: GetSelection

        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection( Type entityType, Control[] controls )
        {
            var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView );
            var ddlRoleType = controls.GetByName<RockDropDownList>( _CtlRoleType );
            var ddlGroupMemberStatus = controls.GetByName<RockDropDownList>( _CtlGroupStatus );

            var settings = new SelectSettings();

            settings.MemberStatus = ddlGroupMemberStatus.SelectedValue.ConvertToEnumOrNull<GroupMemberStatus>();
            settings.RoleType = ddlRoleType.SelectedValue.ConvertToEnumOrNull<RoleTypeSpecifier>();
            settings.DataViewGuid = DataComponentSettingsHelper.GetDataViewGuid( ddlDataView.SelectedValue );

            return settings.ToSelectionString();
        }
開發者ID:NewSpring,項目名稱:Rock,代碼行數:23,代碼來源:GroupDataViewFilter.cs

示例4: GetSelection

        /// <summary>
        /// Gets a formatted string representing the current filter control values.
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection( Type entityType, Control[] controls )
        {
            var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView );
            var ddlCompare = controls.GetByName<RockDropDownList>( _CtlComparison );
            var nbValue = controls.GetByName<NumberBox>( _CtlMemberCount );

            var settings = new FilterSettings();

            settings.PersonDataViewGuid = DataComponentSettingsHelper.GetDataViewGuid( ddlDataView.SelectedValue );
            settings.PersonCountComparison = ddlCompare.SelectedValueAsEnum<ComparisonType>( ComparisonType.GreaterThan );
            settings.PersonCount = nbValue.Text.AsInteger();

            return settings.ToSelectionString();
        }
開發者ID:azturner,項目名稱:Rock,代碼行數:22,代碼來源:ContainsPeopleFilter.cs

示例5: RenderControls

        /// <summary>
        /// Renders the child controls used to display and edit the filter settings for HTML presentation.
        /// </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 controls being rendered.</param>
        /// <param name="writer">The writer being used to generate the HTML for the output page.</param>
        /// <param name="controls">The model representation of the child controls for this component.</param>
        public override void RenderControls( Type entityType, FilterField filterControl, HtmlTextWriter writer, Control[] controls )
        {
            var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView );
            var ddlCompare = controls.GetByName<RockDropDownList>( _CtlComparison );
            var nbValue = controls.GetByName<NumberBox>( _CtlMemberCount );

            ddlDataView.RenderControl( writer );

            // Comparison Row
            writer.AddAttribute( "class", "row field-criteria" );
            writer.RenderBeginTag( HtmlTextWriterTag.Div );

            // Comparison Type
            writer.AddAttribute( "class", "col-md-4" );
            writer.RenderBeginTag( HtmlTextWriterTag.Div );
            ddlCompare.RenderControl( writer );
            writer.RenderEndTag();

            // Comparison Value
            writer.AddAttribute( "class", "col-md-8" );
            writer.RenderBeginTag( HtmlTextWriterTag.Div );
            nbValue.RenderControl( writer );
            writer.RenderEndTag();

            writer.RenderEndTag();

            RegisterFilterCompareChangeScript( filterControl );
        }
開發者ID:azturner,項目名稱:Rock,代碼行數:35,代碼來源:ContainsPeopleFilter.cs

示例6: GetSelection

        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection( Type entityType, Control[] controls )
        {
            var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView );
            var ddlLocationType = controls.GetByName<RockDropDownList>( _CtlLocationType );

            var settings = new FilterSettings();

            settings.LocationTypeGuid = ddlLocationType.SelectedValue.AsGuidOrNull();
            settings.DataViewGuid = DataComponentSettingsHelper.GetDataViewGuid( ddlDataView.SelectedValue );

            return settings.ToSelectionString();
        }
開發者ID:NewSpring,項目名稱:Rock,代碼行數:21,代碼來源:LocationDataViewFilter.cs

示例7: SetSelection

        /// <summary>
        /// Sets the selection.
        /// Implement this version of SetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection( Type entityType, Control[] controls, string selection )
        {
            var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView );
            var ddlLocationType = controls.GetByName<RockDropDownList>( _CtlLocationType );

            var settings = new FilterSettings( selection );

            if (!settings.IsValid)
            {
                return;
            }

            ddlDataView.SelectedValue = DataComponentSettingsHelper.GetDataViewId( settings.DataViewGuid ).ToStringSafe();
            ddlLocationType.SelectedValue = settings.LocationTypeGuid.ToStringSafe();
        }
開發者ID:NewSpring,項目名稱:Rock,代碼行數:22,代碼來源:LocationDataViewFilter.cs

示例8: SetSelection

        /// <summary>
        /// Sets the selection.
        /// Implement this version of SetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection( Type entityType, Control[] controls, string selection )
        {
            // Get selection control instances.
            var pnlGroupAttributeFilterControls = controls.GetByName<DynamicControlsPanel>( _CtlGroup );
            var ddlProperty = controls.GetByName<DropDownList>( _CtlProperty );

            if (pnlGroupAttributeFilterControls == null)
            {
                return;
            }

            var settings = new FilterSettings( selection );

            if (!settings.IsValid)
            {
                return;
            }

            if (settings.AttributeFilterSettings.Any())
            {
                var entityFields = GetGroupMemberAttributes();

                var panelControls = new List<Control>();

                panelControls.AddRange( pnlGroupAttributeFilterControls.Controls.OfType<Control>() );

                var parameters = new List<string> {settings.AttributeKey};

                parameters.AddRange( settings.AttributeFilterSettings );

                SetEntityFieldSelection( entityFields, ddlProperty, parameters, panelControls );
            }
        }
開發者ID:SparkDevNetwork,項目名稱:Rock,代碼行數:40,代碼來源:GroupMemberAttributesFilter.cs

示例9: RenderControls

        /// <summary>
        /// Renders the child controls used to display and edit the filter settings for HTML presentation.
        /// Implement this version of RenderControls if your DataFilterComponent works the same in all FilterModes
        /// </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 controls being rendered.</param>
        /// <param name="writer">The writer being used to generate the HTML for the output page.</param>
        /// <param name="controls">The model representation of the child controls for this component.</param>
        public override void RenderControls( Type entityType, FilterField filterControl, HtmlTextWriter writer, Control[] controls )
        {
            var pnlGroupAttributeFilterControls = controls.GetByName<DynamicControlsPanel>( _CtlGroup );
            var ddlProperty = controls.GetByName<DropDownList>( _CtlProperty );

            if (pnlGroupAttributeFilterControls == null)
            {
                return;
            }

            var panelControls = new List<Control>();
            panelControls.AddRange( pnlGroupAttributeFilterControls.Controls.OfType<Control>() );

            var entityFields = GetGroupMemberAttributes();

            RenderEntityFieldsControls( entityType, filterControl, writer, entityFields, ddlProperty, panelControls, pnlGroupAttributeFilterControls.ID, FilterMode.AdvancedFilter );
        }
開發者ID:SparkDevNetwork,項目名稱:Rock,代碼行數:25,代碼來源:GroupMemberAttributesFilter.cs

示例10: GetSelection

        /// <summary>
        /// Gets the selection.
        /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes
        /// </summary>
        /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param>
        /// <param name="controls">The collection of controls used to set the filter values.</param>
        /// <returns>
        /// A formatted string.
        /// </returns>
        public override string GetSelection( Type entityType, Control[] controls )
        {
            // Get selection control instances.
            var pnlGroupAttributeFilterControls = controls.GetByName<DynamicControlsPanel>( _CtlGroup );
            var ddlProperty = controls.GetByName<DropDownList>( _CtlProperty );

            if (pnlGroupAttributeFilterControls == null)
            {
                return null;
            }

            var settings = new FilterSettings();
            settings.AttributeKey = ddlProperty.SelectedValue;

            var entityFields = GetGroupMemberAttributes();
            var entityField = entityFields.FirstOrDefault( f => f.Name == ddlProperty.SelectedValue );
            if (entityField != null)
            {
                var panelControls = new List<Control>();
                panelControls.AddRange( pnlGroupAttributeFilterControls.Controls.OfType<Control>() );

                var control = panelControls.FirstOrDefault( c => c.ID.EndsWith( "_" + entityField.Name ) );

                if (control != null)
                {
                    entityField.FieldType.Field.GetFilterValues( control, entityField.FieldConfig, FilterMode.AdvancedFilter ).ForEach( v => settings.AttributeFilterSettings.Add( v ) );
                }
            }

            return settings.ToSelectionString();
        }
開發者ID:SparkDevNetwork,項目名稱:Rock,代碼行數:40,代碼來源:GroupMemberAttributesFilter.cs


注:本文中的System.Web.UI.Control.GetByName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。