Exemplo n.º 1
0
        ///
        /// <summary>
        /// Render this control to the writer parameter specified.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their Render.
        /// </remarks>
        /// <param name="writer">The <see cref="HtmlTextWriter"/> object that receives the server control content.</param>
        ///
        protected override void Render(HtmlTextWriter writer)
        {
            HtmlTextWriter realWriter = HtmlTextWriterFactory.CreateCorrectHtmlTextWriter(writer);

            PowerPack.Announce(realWriter, ProductName);

            if (Page != null)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            _realField.FinaliseAttributes();

            _realField.RenderBeforeControl(realWriter);

            base.RenderBeginTag(realWriter);
            foreach (ListItem liItem in Items)
            {
                string selected = liItem.Selected ? "selected=\"selected\" " : String.Empty;
                realWriter.Write("\t<option {2}value=\"{0}\">{1}</option>\n", HttpUtility.HtmlEncode(liItem.Value), liItem.Text, selected);
            }

            base.RenderEndTag(realWriter);
            if (!IsInDesignMode)
            {
                _realField.RenderMidText(realWriter);
                _realField.ApplyStyle(ControlStyle);
                _realField.RenderControl(realWriter);
                _realField.RenderAfterControl(realWriter);
            }

            return;
        }
Exemplo n.º 2
0
        //============================================================
        // Events
        //============================================================

        ///
        /// <summary>
        /// Raises the Init event.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their OnInit.
        /// </remarks>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        ///
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            PowerPack.EnsureIdSet(this);

            if (DesignMode)
            {
            }
            else
            {
                BrowserType browserType = GetBrowserType();
                switch (browserType)
                {
                case BrowserType.FireFox2:
                case BrowserType.IE5Up:
                case BrowserType.IE6Up:
                case BrowserType.IE7Up:
                case BrowserType.Mozilla:
                case BrowserType.Netscape:
                case BrowserType.WebKit:
                    _uplevelBrowser = true;
                    break;
                }
            }

            return;
        }
Exemplo n.º 3
0
        ///
        /// <summary>
        /// Raises the <see cref="Control.Init"/> event.
        /// </summary>
        /// <remarks>
        /// When notified by this method, server controls must perform any initialization steps that are required
        /// to create and set up an instance. In this stage of the server control's lifecycle, the control's view
        /// state has yet to be populated. Additionally, you can not access other server controls when this method
        /// is called either, regardless of whether it is a child or parent to this control. Other server controls
        /// are not certain to be created and ready for access.
        /// </remarks>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        ///
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            PowerPack.EnsureIdSet(this);

            Page.RegisterRequiresPostBack(this);

            EnsureChildControls();

            base.TabIndex = -1;

            if ((Style ["position"] == null) && (Style ["POSITION"] == null))
            {
                Style.Add("position", "absolute");
            }
            else
            {
                _explicitlyAbsolutelyPositioned = true;
            }

            if (!IsInDesignMode)
            {
                Style.Add("display", "none");
            }

            _realField.Text = Text;

            return;
        }
Exemplo n.º 4
0
        ///
        /// <summary>
        /// Render this control to the writer parameter specified.
        /// </summary>
        /// <remarks>
        /// This is the method that actually outputs the HTML generated by the control into the page's
        /// HTML text stream.  You do not normally need to call this method directly.
        /// </remarks>
        /// <param name="writer">The <see cref="HtmlTextWriter"/> object that receives the server control content.</param>
        ///
        protected override void Render(HtmlTextWriter writer)
        {
            HtmlTextWriter realWriter = HtmlTextWriterFactory.CreateCorrectHtmlTextWriter(writer);

            PowerPack.Announce(realWriter, ProductName);

            if (Page != null)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            bool uplevelBrowser = false;

            if (_realField is WysiwygRTField)
            {
                uplevelBrowser = true;
            }

            if (Page == null)
            {
                throw new ApplicationException("Page must not be null.");
            }

            if ((uplevelBrowser) && (Prompt != null) && (!Page.IsPostBack))
            {
                AddPromptAttributes();
            }

            _realField.Render(realWriter);

            return;
        }
Exemplo n.º 5
0
        ///
        /// <summary>
        /// Raises the Render event and outputs the control to the page.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their Render.
        /// </remarks>
        /// <param name="writer">The <see cref="HtmlTextWriter"/> object that receives the server control content.</param>
        ///
        protected override void Render(HtmlTextWriter writer)
        {
            HtmlTextWriter realWriter = HtmlTextWriterFactory.CreateCorrectHtmlTextWriter(writer);

            PowerPack.Announce(realWriter, ProductName);

            if (Page != null)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            RenderBeginTag(realWriter);
            if (IsIE() && EnableClientScript)
            {
                RenderContents_IE(writer);
            }
            else if (IsMozilla() && EnableClientScript)
            {
                RenderContents_Moz(writer);
            }
            else
            {
                if (IsExpanded())
                {
                    RenderContents_Default(writer);
                }
                else
                {
                    Visible = false;
                }
            }
            RenderEndTag(realWriter);

            return;
        }
Exemplo n.º 6
0
        //============================================================
        // Events
        //============================================================

        ///
        /// <summary>
        /// Initialises the control and creates any necessary child controls.
        /// </summary>
        /// <remarks>
        /// This must be called by the ASP.NET system to properly initialise the control.
        /// </remarks>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        ///
        protected override void OnInit(EventArgs e)
        {
            EnsureChildControls();

            base.OnInit(e);

            PowerPack.EnsureIdSet(this);

            Page.RegisterRequiresPostBack(this);

            if (IsIE() && EnableClientScript)
            {
                OnInit_IE();
            }
            else if (IsMozilla() && EnableClientScript)
            {
                OnInit_Moz();
            }
            else
            {
                OnInit_Default();
            }

            SetStateBasedOnEnabled();

            return;
        }
Exemplo n.º 7
0
        //============================================================
        // Properties
        //============================================================

        //============================================================
        // Events
        //============================================================

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            PowerPack.EnsureIdSet(this);

            return;
        }
Exemplo n.º 8
0
        ///
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <remarks>
        /// This is the method that actually outputs the HTML generated by the control into the page's
        /// HTML text stream.  You do not normally need to call this method directly.
        /// </remarks>
        /// <param name="writer">The <see cref="HtmlTextWriter"/> object that receives the server control content.</param>
        ///
        protected override void Render(HtmlTextWriter writer)
        {
            HtmlTextWriter realWriter = HtmlTextWriterFactory.CreateCorrectHtmlTextWriter(writer);

            PowerPack.Announce(realWriter, ProductName);

            return;
        }
Exemplo n.º 9
0
        //============================================================
        // Methods
        //============================================================

        ///
        /// <summary>
        /// Raises the <see cref="Control.Init"/> event.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their OnInit.
        /// </remarks>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        ///
        protected override void OnInit (EventArgs e)
        {
            base.OnInit (e);

            PowerPack.EnsureIdSet (this);

            ControlToValidate = ID;

            return;
        }
Exemplo n.º 10
0
        ///
        /// <summary>
        /// Raises the Render event and outputs the control to the page.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their Render.
        /// </remarks>
        /// <param name="writer">The <see cref="HtmlTextWriter"/> object that receives the server control content.</param>
        ///
        protected override void Render(HtmlTextWriter writer)
        {
            HtmlTextWriter realWriter = HtmlTextWriterFactory.CreateCorrectHtmlTextWriter(writer);

            PowerPack.Announce(realWriter, ProductName);

            if (String.IsNullOrEmpty(ImageUrl))
            {
                ImageUrl = Page.ClientScript.GetWebResourceUrl(typeof(PopupImageButton), PopupConstants.IconResource);
            }

            base.Render(realWriter);

            return;
        }
        ///
        /// <summary>
        /// Raises the Render event and outputs the control to the page.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their Render.
        /// </remarks>
        /// <param name="writer">The <see cref="HtmlTextWriter"/> object that receives the server control content.</param>
        ///
        protected override void Render(HtmlTextWriter writer)
        {
            HtmlTextWriter realWriter = HtmlTextWriterFactory.CreateCorrectHtmlTextWriter(writer);

            PowerPack.Announce(realWriter, ProductName);

            if (Page != null)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            base.Render(realWriter);

            return;
        }
Exemplo n.º 12
0
        ///
        /// <summary>
        /// Raises the Render event and outputs the control to the page.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their Render.
        /// </remarks>
        /// <param name="writer">The <see cref="HtmlTextWriter"/> object that receives the server control content.</param>
        ///
        protected override void Render(HtmlTextWriter writer)
        {
            HtmlTextWriter realWriter = HtmlTextWriterFactory.CreateCorrectHtmlTextWriter(writer);

            PowerPack.Announce(realWriter, ProductName);

            if ((_uplevelBrowser) && (_prompt != null) && (_promptScriptOutput) && (!Page.IsPostBack))
            {
                AddPromptAttributes();
            }

            base.Render(realWriter);

            return;
        }
Exemplo n.º 13
0
        ///
        /// <summary>
        /// Render this control to the writer parameter specified.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their Render.
        /// </remarks>
        /// <param name="writer">The <see cref="HtmlTextWriter"/> object that receives the server control content.</param>
        ///
        protected override void Render(HtmlTextWriter writer)
        {
            HtmlTextWriter realWriter = HtmlTextWriterFactory.CreateCorrectHtmlTextWriter(writer);

            PowerPack.Announce(realWriter, ProductName);

            string innerHtml = GetInnerHtml();

            _blockedWords = GetConfiguration(_configFile);

            string filteredInnerHtml = FilterHtml(innerHtml);

            realWriter.Write(filteredInnerHtml);

            return;
        }
Exemplo n.º 14
0
        //============================================================
        // Events
        //============================================================

        ///
        /// <summary>
        /// Raises the <see cref="Control.Init"/> event.
        /// </summary>
        /// <remarks>
        /// When notified by this method, server controls must perform any initialization steps that are required
        /// to create and set up an instance. In this stage of the server control's lifecycle, the control's view
        /// state has yet to be populated. Additionally, you can not access other server controls when this method
        /// is called either, regardless of whether it is a child or parent to this control. Other server controls
        /// are not certain to be created and ready for access.
        /// </remarks>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        ///
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            PowerPack.EnsureIdSet(this);

            EnsureChildControls();

            Page.RegisterRequiresPostBack(this);

            if ((DefaultToCurrentDate) && (!Page.IsPostBack))
            {
                Value = DateTime.Now;
            }

            return;
        }
Exemplo n.º 15
0
        ///
        /// <summary>
        /// Raises the Render event and outputs the control to the page.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their Render.
        /// </remarks>
        /// <param name="writer">The <see cref="System.Web.UI.HtmlTextWriter"/> object that receives the server control content.</param>
        ///
        protected override void Render(HtmlTextWriter writer)
        {
            bool visible = false;

            if (Context.Request.IsAuthenticated)
            {
                string users = Users;
                if (!String.IsNullOrEmpty(users))
                {
                    string[] usersArray = users.Split(roleSeparators);
                    foreach (string user in usersArray)
                    {
                        if (Context.User.Identity.Name.Equals(user.Trim()))
                        {
                            visible = true;
                        }
                    }
                }

                string roles = Roles;
                if ((!visible) && !String.IsNullOrEmpty(roles))
                {
                    string[] rolesArray = roles.Split(roleSeparators);
                    foreach (string szRole in rolesArray)
                    {
                        if (Context.User.IsInRole(szRole.Trim()))
                        {
                            visible = true;
                        }
                    }
                }
            }

            if (visible)
            {
                HtmlTextWriter realWriter = HtmlTextWriterFactory.CreateCorrectHtmlTextWriter(writer);
                PowerPack.Announce(realWriter, ProductName);

                base.Render(realWriter);
            }

            return;
        }
Exemplo n.º 16
0
        //============================================================
        // Events
        //============================================================

        ///
        /// <summary>
        /// Initialises the control.
        /// </summary>
        /// <remarks>
        /// Note for inheritors - for this control to function properly, any derived controls that override
        /// this method should ensure that they call this base method as part of their OnInit.
        /// </remarks>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        ///
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            PowerPack.EnsureIdSet(this);

            if (!DesignMode)
            {
                if (FindControl(ControlToHide) == null)
                {
                    throw new InvalidOperationException(Globalisation.GetString("controlWithIdCouldNotBeFound_Id", ControlToHide));
                }

                if (FindControl(ControlToTest) == null)
                {
                    throw new InvalidOperationException(Globalisation.GetString("controlWithIdCouldNotBeFound_Id", ControlToTest));
                }
            }

            return;
        }