protected override void RenderHeader(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            TitleStyle headerStyle = base.HeaderStyle;

            if (!headerStyle.IsEmpty)
            {
                Style style2 = new Style();
                if (!headerStyle.ForeColor.IsEmpty)
                {
                    style2.ForeColor = headerStyle.ForeColor;
                }
                style2.Font.CopyFrom(headerStyle.Font);
                if (!headerStyle.Font.Size.IsEmpty)
                {
                    style2.Font.Size = new FontUnit(new Unit(100.0, UnitType.Percentage));
                }
                if (!style2.IsEmpty)
                {
                    style2.AddAttributesToRender(writer, this);
                }
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            HorizontalAlign horizontalAlign = headerStyle.HorizontalAlign;

            if (horizontalAlign != HorizontalAlign.NotSet)
            {
                TypeConverter converter = TypeDescriptor.GetConverter(typeof(HorizontalAlign));
                writer.AddAttribute(HtmlTextWriterAttribute.Align, converter.ConvertToString(horizontalAlign));
            }
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(this.HeaderText);
            writer.RenderEndTag();
            WebPartVerb headerCloseVerb = this.HeaderCloseVerb;

            if (headerCloseVerb.Visible)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                ZoneLinkButton button = new ZoneLinkButton(this, headerCloseVerb.EventArgument)
                {
                    Text     = headerCloseVerb.Text,
                    ImageUrl = headerCloseVerb.ImageUrl,
                    ToolTip  = headerCloseVerb.Description,
                    Enabled  = headerCloseVerb.Enabled,
                    Page     = this.Page
                };
                button.ApplyStyle(this.HeaderVerbStyle);
                button.RenderControl(writer);
                writer.RenderEndTag();
            }
            writer.RenderEndTag();
            writer.RenderEndTag();
        }
Exemplo n.º 2
0
 protected internal override void RenderContents(HtmlTextWriter writer)
 {
     if (this.HasHeader)
     {
         writer.RenderBeginTag(HtmlTextWriterTag.Tr);
         TitleStyle headerStyle = this.HeaderStyle;
         if (!headerStyle.IsEmpty)
         {
             headerStyle.AddAttributesToRender(writer, this);
         }
         writer.RenderBeginTag(HtmlTextWriterTag.Td);
         this.RenderHeader(writer);
         writer.RenderEndTag();
         writer.RenderEndTag();
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Tr);
     writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%");
     writer.RenderBeginTag(HtmlTextWriterTag.Td);
     this.RenderBody(writer);
     writer.RenderEndTag();
     writer.RenderEndTag();
     if (this.HasFooter)
     {
         writer.RenderBeginTag(HtmlTextWriterTag.Tr);
         TitleStyle footerStyle = this.FooterStyle;
         if (!footerStyle.IsEmpty)
         {
             footerStyle.AddAttributesToRender(writer, this);
         }
         writer.RenderBeginTag(HtmlTextWriterTag.Td);
         this.RenderFooter(writer);
         writer.RenderEndTag();
         writer.RenderEndTag();
     }
 }
Exemplo n.º 3
0
        protected internal override void RenderContents(HtmlTextWriter writer)
        {
            if (HasHeader)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                TitleStyle headerStyle = HeaderStyle;
                if (!headerStyle.IsEmpty)
                {
                    headerStyle.AddAttributesToRender(writer, this);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                RenderHeader(writer);
                writer.RenderEndTag();  // Td
                writer.RenderEndTag();  // Tr
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // We want the body to fill the height of the zone, and squish the header and footer
            // to the size of their contents
            // Mac IE needs height=100% set on <td> instead of <tr>
            writer.AddStyleAttribute(HtmlTextWriterStyle.Height, "100%");

            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            RenderBody(writer);
            writer.RenderEndTag();  // Td
            writer.RenderEndTag();  // Tr

            if (HasFooter)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                TitleStyle footerStyle = FooterStyle;
                if (!footerStyle.IsEmpty)
                {
                    footerStyle.AddAttributesToRender(writer, this);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                RenderFooter(writer);
                writer.RenderEndTag();  // Td
                writer.RenderEndTag();  // Tr
            }
        }
Exemplo n.º 4
0
        protected override void RenderHeader(HtmlTextWriter writer)
        {
            // Render title bar
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "2");
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");

            TitleStyle headerStyle = HeaderStyle;

            if (!headerStyle.IsEmpty)
            {
                // Apply font and forecolor from HeaderStyle to inner table
                Style style = new Style();
                if (!headerStyle.ForeColor.IsEmpty)
                {
                    style.ForeColor = headerStyle.ForeColor;
                }
                style.Font.CopyFrom(headerStyle.Font);
                if (!headerStyle.Font.Size.IsEmpty)
                {
                    // If the font size is specified on the HeaderStyle, force the font size to 100%,
                    // so it inherits the font size from its parent in IE compatibility mode. I would
                    // think that "1em" would work here as well, but "1em" doesn't work when you change
                    // the font size in the browser.
                    style.Font.Size = new FontUnit(new Unit(100, UnitType.Percentage));
                }
                if (!style.IsEmpty)
                {
                    style.AddAttributesToRender(writer, this);
                }
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            // Copied from Panel.cs
            //
            HorizontalAlign hAlign = headerStyle.HorizontalAlign;

            if (hAlign != HorizontalAlign.NotSet)
            {
                TypeConverter hac = TypeDescriptor.GetConverter(typeof(HorizontalAlign));
                writer.AddAttribute(HtmlTextWriterAttribute.Align, hac.ConvertToString(hAlign));
            }

            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(HeaderText);
            writer.RenderEndTag();  // Td

            WebPartVerb headerCloseVerb = HeaderCloseVerb;

            if (headerCloseVerb.Visible)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.WhiteSpace, "nowrap");
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                ZoneLinkButton closeButton = new ZoneLinkButton(this, headerCloseVerb.EventArgument);
                closeButton.Text     = headerCloseVerb.Text;
                closeButton.ImageUrl = headerCloseVerb.ImageUrl;
                closeButton.ToolTip  = headerCloseVerb.Description;
                closeButton.Enabled  = headerCloseVerb.Enabled;
                closeButton.Page     = Page;
                closeButton.ApplyStyle(HeaderVerbStyle);
                closeButton.RenderControl(writer);
                writer.RenderEndTag();  // Td
            }

            writer.RenderEndTag();  // Tr
            writer.RenderEndTag();  // Table
        }