コード例 #1
0
        /// <summary>7
        /// Overridden OnPreRender method. Build data-options and add it into extender target as an data-options attribute.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (DesignMode)
            {
                return;
            }

            var dataOptions       = JQueryScriptBuilder.BuildDataOptionsAttribute(this);
            var targetControl     = this.TargetControl as WebControl;
            var htmlTargetControl = this.TargetControl as HtmlControl;

            if (targetControl == null && htmlTargetControl == null)
            {
                throw new Exception("Target control type must be WebControl or HtmlControl");
            }

            _targetControlType = TargetControl.GetType();

            TargetControl.Parent.SetRenderMethodDelegate(RenderTargetControl);
            var attrs = (targetControl != null)
                            ? (targetControl is CheckBox)
                ? (targetControl as CheckBox).InputAttributes
                                    : targetControl.Attributes
                            : (htmlTargetControl != null)
                                ? htmlTargetControl.Attributes
                                    : null;

            if (attrs != null)
            {
                attrs.Add(DataOptionPrefix + _attrControlName, dataOptions);
            }
        }
コード例 #2
0
        /// <summary>
        /// Overridden OnPreRender method. Build data-options and add it into extender target as an data-options attribute.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (DesignMode)
            {
                return;
            }

            var dataOptions = JQueryScriptBuilder.BuildDataOptionsAttribute(this);

            this.Attributes.Add(DataOptionPrefix + _attrControlName, dataOptions);
        }