Пример #1
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            IPageable paging = this.NamingContainer.FindControl(this.PageLinkFor) as IPageable;
            if (paging == null)
            {
                throw new ArgumentException(
                    string.Format(
                    "The control specified using PageLinkFor ({0}) is not valid.  This property must be set to the ID of "
                    + "a control that implements IPageable.",
                    this.PageLinkFor
                    )
                );
            }

            writer.WriteBeginTag("select");
            writer.WriteAttribute("onchange", "location = this.options[this.selectedIndex].value;");
            writer.Write(HtmlTextWriter.TagRightChar);

            foreach (PagePair pair in paging.AllPages)
            {
                writer.WriteBeginTag("option");
                writer.WriteAttribute("value", pair.Link);
                if (pair.Link == paging.CurrentPage.Link) writer.WriteAttribute("selected", "selected");
                writer.Write(HtmlTextWriter.TagRightChar);
                writer.Write(pair.Name);
                writer.WriteEndTag("option");
            }
            writer.WriteEndTag("select");
            base.Render(writer);
        }
Пример #2
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (writer == null)
                return;

            if (this.Controls.Count > 0 && this.Controls[0].Controls.Count > 0 || this.Controls.Count > 1
                || (this.Parent != null && (this.Parent.Controls.Count > 0 && this.Parent.Controls[0].Controls.Count > 1 || this.Parent.Controls.Count > 1)))
            {
                writer.WriteLine(Environment.NewLine);
            }

            writer.WriteBeginTag("input");

            writer.WriteAttribute("type", Attributes["type"]);

            foreach (var key in this.Attributes.Keys)
            {
                string attr = (string)key;

                if (attr != "name" && attr != "type")
                    writer.WriteAttribute(attr, Attributes[attr]);
            }

            writer.Write(HtmlTextWriter.SelfClosingTagEnd);
            if (this.Controls.Count > 0 && this.Controls[0].Controls.Count > 0 || this.Controls.Count > 1
                || (this.Parent != null && (this.Parent.Controls.Count > 0 && this.Parent.Controls[0].Controls.Count > 1 || this.Parent.Controls.Count > 1)))
            {
                writer.WriteLine(Environment.NewLine);
            }
        }
Пример #3
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {

            writer.WriteBeginTag("div");
            writer.WriteAttribute("class", "umbLabelButton");
            writer.Write(HtmlTextWriter.TagRightChar);
            base.Render(writer);
            caption.RenderControl(writer);
            writer.WriteEndTag("div");
        }
Пример #4
0
 protected override void Render(System.Web.UI.HtmlTextWriter writer)
 {
     writer.WriteBeginTag("li");
     writer.WriteAttribute("class", this.CssClass);
     if (!String.IsNullOrEmpty(this.LiLeftMargin))
     {
         writer.WriteAttribute("style", string.Format("margin-left: {0}px", this.LiLeftMargin));
     }
     writer.Write(HtmlTextWriter.TagRightChar);
     this.HyperLink.RenderControl(writer);
     writer.WriteEndTag("li");
 }
Пример #5
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            base.RenderBeginTag(writer);
            writer.WriteBeginTag("script");
            writer.WriteAttribute("type", "text/fbml");
            writer.Write(System.Web.UI.HtmlTextWriter.TagRightChar);

            base.RenderChildren(writer);

            writer.WriteEndTag("script");

            base.RenderEndTag(writer);
        }
Пример #6
0
 protected override void Render(System.Web.UI.HtmlTextWriter writer)
 {
     writer.WriteBeginTag("form");
     string url = Mubble.MubbleUrl.Url(this.Path, this.Handler);
     writer.WriteAttribute("mubble-action", url);
     writer.WriteAttribute("method", this.Method);
     writer.Write(HtmlTextWriter.TagRightChar);
     writer.Write(Environment.NewLine);
     writer.Indent = writer.Indent + 1;
     this.RenderChildren(writer);
     writer.Indent = writer.Indent - 1;
     writer.WriteEndTag("form");
 }
Пример #7
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (this.PageLinkFor != null)
            {
                IPaging paging = this.NamingContainer.FindControl(this.PageLinkFor) as IPaging;
                if (paging == null)
                {
                    throw new ArgumentException(
                        string.Format(
                        "The control specified using PageLinkFor ({0}) is not valid.  This property must be set to the ID of "
                        + "a control that implements IPaging.",
                        this.PageLinkFor
                        )
                    );
                }

                writer.WriteBeginTag("select");
                writer.WriteAttribute("onchange", "location = this.options[this.selectedIndex].value;");
                writer.Write(HtmlTextWriter.TagRightChar);

                if (paging.PageLinks != null)
                {
                    foreach (Link pair in paging.PageLinks)
                    {
                        writer.WriteBeginTag("option");
                        writer.WriteAttribute("value", MubbleUrl.Url(pair, this.Handler));
                        if (pair.Equals(paging.CurrentPageLink)) writer.WriteAttribute("selected", "selected");
                        writer.Write(HtmlTextWriter.TagRightChar);
                        writer.Write(pair.Title);
                        writer.WriteEndTag("option");
                    }
                }
                writer.WriteEndTag("select");

                base.Render(writer);
            }
        }
Пример #8
0
 protected override void Render(System.Web.UI.HtmlTextWriter writer)
 {
     if (Page.Request.Headers["X-FB-USER-REMOTE-ADDR"] != null)
     {
         writer.WriteBeginTag("fb:title");
         writer.Write(System.Web.UI.HtmlTextWriter.TagRightChar);
         writer.Write(Page.Title);
         writer.WriteEndTag("fb:title");
         Page.Form.RenderControl(writer);
     }
     else
     {
         base.Render(writer);
     }
 }
Пример #9
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            ICollection attributes = base.Attributes.Keys;

            writer.WriteBeginTag(base.TagName);
            if (!String.IsNullOrEmpty(base.ID))
            {
                writer.WriteAttribute("id", base.UniqueID);
                writer.WriteAttribute("name", base.UniqueID);
            }

            foreach (var attr in attributes)
            {
                writer.WriteAttribute(attr.ToString(), base.Attributes[attr.ToString()]);
            }

            writer.Write(" />");
            writer.Write(writer.NewLine);
        }
Пример #10
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            writer.WriteLine();
            writer.WriteBeginTag("script");

            if (this.Type != null)
            {
                writer.WriteAttribute("type", this.Type);
            }

            if (this.Src != null)
            {
                writer.WriteAttribute("src", Control.ResolveUrl(this, this.Src));
            }

            writer.Write(HtmlTextWriter.TagRightChar);
            writer.WriteEndTag("script");
            base.Render(writer);
        }
Пример #11
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (this.FileLocation == IncludedFileLocation.Shared)
            {
                this.Href = System.IO.Path.Combine("~/Templates/shared", this.Href);
            }
            else if (this.FileLocation == IncludedFileLocation.Template)
            {
                this.Href = System.IO.Path.Combine(Controller.Template.Path, this.Href);
            }
            this.Href = Page.ResolveUrl(this.Href);
            if (this.FileType == IncludedFileType.Static)
            {
                this.Href = Config.Caching.GetCachedVersionUrl(this.Href, this.UseStaticFileHost);
            }

            int spaces = writer.Indent;
            writer.WriteBeginTag("link");

            writer.WriteAttribute("type", "text/css");

            if (this.Rel != null)
            {
                writer.WriteAttribute("rel", this.Rel);
            }

            if (this.Media != null)
            {
                writer.WriteAttribute("media", this.Media);
            }

            if (this.Href != null)
            {
                writer.WriteAttribute("href", this.Href);
            }

            writer.Write(HtmlTextWriter.SelfClosingTagEnd);
            writer.WriteLine();
            writer.Indent = spaces;
        }
Пример #12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="writer"></param>
 protected override void Render(System.Web.UI.HtmlTextWriter writer)
 {
     writer.WriteBeginTag("input");
     this.RenderAttributes(writer);
     writer.Write(">");
 }
        /// <summary>
        /// Renders the HTML for the HealthRecordItemDataGrid.
        /// </summary>
        /// 
        /// <remarks>
        /// The control consists of 3 main elements:
        /// <div class="CssClass">
        ///    <div>
        ///       <table>GridView</table>
        ///    </div>
        ///    <div>Error Message</div>
        /// </div>
        /// </remarks>
        /// 
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            // Verify that the control is nested within a form.
            // This is required for postbacks
            if (Page != null)
            {
                Page.VerifyRenderingInServerForm(this);
            }

            writer.WriteBeginTag("div");

            writer.WriteAttribute("id", this.ClientID);

            if (!String.IsNullOrEmpty(_cssClass))
            {
                writer.WriteAttribute("class", _cssClass);
            }

            writer.Write(HtmlTextWriter.TagRightChar);

            RenderChildren(writer);

            if (_showErrorMessages)
            {
                if (_numResults == 0)
                {
                    writer.WriteBeginTag("div");
                    writer.Write(HtmlTextWriter.TagRightChar);

                    writer.Write(
                        ResourceRetriever.GetResourceString(
                            "NoResultsFound"));
                    writer.WriteEndTag("div");
                }

                if (_isFiltered)
                {
                    writer.WriteBeginTag("div");
                    writer.Write(HtmlTextWriter.TagRightChar);

                    writer.Write(
                        ResourceRetriever.GetResourceString(
                            "FilteredResults"));
                    writer.WriteEndTag("div");
                }
            }

            writer.WriteEndTag("div");
        }
Пример #14
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (this.FileType == IncludedFileType.Application)
            {
                this.Src = string.Concat("~/application.", Handlers.Javascript.Version, ".js.ashx");
                this.Src = Page.ResolveUrl(this.Src);
            }
            else
            {
                if (this.FileLocation == IncludedFileLocation.Shared)
                {
                    this.Src = System.IO.Path.Combine("~/Templates/shared", this.Src);
                }
                else if(this.FileLocation == IncludedFileLocation.Template)
                {
                    this.Src = System.IO.Path.Combine(Controller.Template.Path, this.Src);
                }
                this.Src = Page.ResolveUrl(this.Src);
                if (this.FileType == IncludedFileType.Static)
                {
                    this.Src = Config.Caching.GetCachedVersionUrl(this.Src, this.UseStaticFileHost);
                }
            }

            int spaces = writer.Indent;
            writer.WriteBeginTag("script");
            writer.WriteAttribute("type", "text/javascript");
            writer.WriteAttribute("src", this.Src);
            writer.Write(HtmlTextWriter.TagRightChar);
            writer.WriteEndTag("script");
            writer.WriteLine();
            writer.Indent = spaces;
        }
Пример #15
0
        /// <summary>
        /// Overrides the RenderContents method.
        /// </summary>
        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            Boolean oneSelected = false;

            foreach( ListItem item in this.Items ) {
                writer.WriteBeginTag("option");
                if ( item.Selected ) {
                    if ( !oneSelected ) {
                        writer.WriteAttribute( "selected", "selected", false );
                    }
                    oneSelected = true;
                }

                writer.WriteAttribute( "value", item.Value, true );
                writer.Write(">");
                HttpUtility.HtmlEncode(item.Text, writer );
                writer.WriteEndTag("option");
                writer.WriteLine();
            }
        }
Пример #16
0
        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            ListItemCollection items = this.Items;
            int count = items.Count;
            if (count > 0)
            {
                bool flag = false;
                string prevOptGroup = null;
                for (int i = 0; i < count; i++)
                {
                    string tag = OptionTag;
                    string optgroupLabel = null;
                    ListItem item = items[i];
                    if (item.Enabled)
                    {
                        if (item.Attributes.Count > 0 && item.Attributes[OptionGroupTag] != null)
                        {
                            optgroupLabel = item.Attributes[OptionGroupTag];

                            if (prevOptGroup != optgroupLabel)
                            {
                                if (prevOptGroup != null)
                                {
                                    writer.WriteEndTag(OptionGroupTag);
                                }
                                writer.WriteBeginTag(OptionGroupTag);
                                if (!string.IsNullOrEmpty(optgroupLabel))
                                {
                                    writer.WriteAttribute("label", optgroupLabel);
                                }
                                writer.Write('>');
                            }
                            item.Attributes.Remove(OptionGroupTag);
                            prevOptGroup = optgroupLabel;
                        }
                        else
                        {
                            if (prevOptGroup != null)
                            {
                                writer.WriteEndTag(OptionGroupTag);
                            }
                            prevOptGroup = null;
                        }

                        writer.WriteBeginTag(tag);
                        if (item.Selected)
                        {
                            if (flag)
                            {
                                this.VerifyMultiSelect();
                            }
                            flag = true;
                            writer.WriteAttribute("selected", "selected");
                        }
                        writer.WriteAttribute("value", item.Value, true);
                        if (item.Attributes.Count > 0)
                        {
                            item.Attributes.Render(writer);
                        }
                        if (optgroupLabel != null)
                        {
                            item.Attributes.Add(OptionGroupTag, optgroupLabel);
                        }
                        if (this.Page != null)
                        {
                            this.Page.ClientScript.RegisterForEventValidation(this.UniqueID, item.Value);
                        }

                        writer.Write('>');
                        HttpUtility.HtmlEncode(item.Text, writer);
                        writer.WriteEndTag(tag);
                        writer.WriteLine();
                        if (i == count - 1)
                        {
                            if (prevOptGroup != null)
                            {
                                writer.WriteEndTag(OptionGroupTag);
                            }
                        }
                    }
                }
            }
        }
        protected override void RenderContents( System.Web.UI.HtmlTextWriter writer )
        {
            writer.WriteBeginTag( "table" );
            writer.WriteAttribute( "cellspacing", "0" );
            writer.WriteAttribute( "cellpadding", "1" );
            writer.Write( HtmlTextWriter.TagRightChar );

            // button
            writer.WriteFullBeginTag( "tr" ); writer.WriteFullBeginTag( "td" );
            writer.WriteBeginTag( "input" );
            writer.WriteAttribute( "type", "submit" );
            writer.WriteAttribute( "name", this.ClientID );
            writer.WriteAttribute( "value", !string.IsNullOrEmpty( this.TitleText ) ? this.TitleText : this.ID.ToString() );
            writer.Write( HtmlTextWriter.TagRightChar );
            writer.WriteEndTag( "input" );
            writer.WriteEndTag( "td" ); writer.WriteEndTag( "tr" );

            // error
            if ( !string.IsNullOrEmpty( this.ErrorText ) )
            {
                writer.WriteFullBeginTag( "tr" ); writer.WriteFullBeginTag( "td" );
                writer.Write( this.ErrorText );
                writer.WriteEndTag( "td" ); writer.WriteEndTag( "tr" );
            }

            writer.WriteEndTag( "table" );
        }
        protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
        {
            // The current control being "adaptered" is available within context from the Control property
            DropDownList dropDownList = (DropDownList)Control;
            ListItemCollection items = dropDownList.Items;

            // Retrieve Optgrouping using LinQ
            var groups = (from p in items.OfType<ListItem>()
                          group p by p.Attributes["Group"] into g
                          select new { Label = g.Key, Items = g.ToList<ListItem>() });

            foreach (var group in groups)
            {
                if (!String.IsNullOrEmpty(group.Label))
                {
                    writer.WriteBeginTag("optgroup");
                    writer.WriteAttribute("label", group.Label);
                    writer.Write(">");
                }

                int count = group.Items.Count();
                if (count > 0)
                {
                    bool flag = false;
                    for (int i = 0; i < count; i++)
                    {
                        ListItem item = group.Items[i];

                        writer.WriteBeginTag("option");
                        if (item.Selected)
                        {
                            if (flag)
                            {
                                throw new HttpException("Multiple selected items not allowed");
                            }
                            flag = true;

                            writer.WriteAttribute("selected", "selected");
                        }

                        if (!item.Enabled)
                        {
                            writer.WriteAttribute("disabled", "true");
                        }

                        writer.WriteAttribute("value", item.Value, true);

                        if (this.Page != null)
                        {
                            this.Page.ClientScript.RegisterForEventValidation(dropDownList.UniqueID, item.Value);
                        }
                        writer.Write('>');
                        HttpUtility.HtmlEncode(item.Text, writer);
                        writer.WriteEndTag("option");
                        writer.WriteLine();
                    }
                }
                if (!String.IsNullOrEmpty(group.Label))
                {
                    writer.WriteEndTag("optgroup");
                }
            }
        }