예제 #1
0
파일: Table.cs 프로젝트: tianzhifeng/EPC
        public override string Render()
        {
            string html = "<table {0}>{1}</table>";
            string attr = this.getAttr();

            attr += " border=\"" + this.Border.ToString() + "\" cellpadding=\"" + CellPadding.ToString() + "\" cellspacing=\"" + CellSpacing.ToString() + "\"";
            string childControlHtml = this.renderChildControl();

            return(String.Format(html, attr, childControlHtml));
        }
        /// <summary>
        /// Render the <see cref="Panel"/> to the output parameter specified.
        /// </summary>
        /// <param name="output">Output stream that contains the HTML used to represent the <see cref="Panel"/>.</param>
        protected override void Render(HtmlTextWriter output)
        {
            output.Write("<div>");

            if (this.BorderStyle != System.Web.UI.WebControls.BorderStyle.NotSet)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, this.BorderStyle.ToString());
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, this.BorderWidth.ToString());
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, Utils.Color2Hex(this.BorderColor));
            }

            if (this.BackColor != Color.Empty)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.BorderColor, Utils.Color2Hex(this.BackColor));
            }

            if (Height.Value > 0)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Height, Height.ToString());
            }

            if (Width.Value > 0)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Width, Width.ToString());
            }

            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, CellSpacing.ToString());
            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, CellPadding.ToString());

            output.RenderBeginTag(HtmlTextWriterTag.Table);             // Open TABLE 1

            foreach (Panel panel in _panels)
            {
                output.RenderBeginTag(HtmlTextWriterTag.Tr);
                output.RenderBeginTag(HtmlTextWriterTag.Td);
                panel.ScriptDirectory = ScriptDirectory;
                panel.ExternalScript  = ExternalScript;
                panel.ImagesDirectory = ImagesDirectory;
                panel.RenderControl(output);
                output.RenderEndTag();
                output.RenderEndTag();
            }
            output.RenderEndTag();             // Close TABLE 1

            output.Write("</div>");
        }
예제 #3
0
        /// <summary>
        /// Render this control to the output parameter specified.
        /// </summary>
        /// <param name="output"> The HTML writer to write out to </param>
        protected override void Render(HtmlTextWriter output)
        {
            DojoSeminar seminar = new DojoSeminar(seminarID);

            output.Write("<table id=\"{0}\"", UniqueID);

            if (!CellPadding.IsEmpty)
            {
                output.Write(" CellPadding=\"{0}\"", CellPadding.ToString());
            }
            if (!CellSpacing.IsEmpty)
            {
                output.Write(" CellPadding=\"{0}\"", CellSpacing.ToString());
            }
            output.Write(" border=\"0\"");
            output.Write(" width=\"100%\"");
            output.Write(">");

            // Output Title
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            if (subtitleCssClass != "")
            {
                output.WriteAttribute("class", subtitleCssClass);
            }
            output.WriteLine(HtmlTextWriter.TagRightChar);
            output.Write(seminar.Name);
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            // Output Subtitle
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            if (subtitleCssClass != "")
            {
                output.WriteAttribute("class", subtitleCssClass);
            }
            output.WriteLine(HtmlTextWriter.TagRightChar);
            output.Write(seminar.Description);
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            // Output Dates
            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            if (datesCssClass != "")
            {
                output.WriteAttribute("class", datesCssClass);
            }
            output.WriteLine(HtmlTextWriter.TagRightChar);
            output.Write(seminar.ConstructDateLongString());
            output.WriteEndTag("td");
            output.WriteEndTag("tr");

            // Output Menu
            if (seminar.RegistrationEnabled)
            {
                output.WriteFullBeginTag("tr");
                output.WriteBeginTag("td");
                if (menuCssClass != "")
                {
                    output.WriteAttribute("class", menuCssClass);
                }
                output.WriteLine(HtmlTextWriter.TagRightChar);
                output.WriteBeginTag("a");
                output.WriteAttribute("href", Page.ResolveUrl(string.Format(registrationUrlFormat, seminar.ID)));
                output.Write(HtmlTextWriter.TagRightChar);
                output.Write("Register");
                output.WriteEndTag("a");
                output.WriteEndTag("td");
                output.WriteEndTag("tr");
            }

            output.WriteFullBeginTag("tr");
            output.WriteBeginTag("td");
            output.Write(HtmlTextWriter.TagRightChar);

            if (seminar.DetailsOverrideUrl.Length > 0)
            {
                try
                {
                    HttpContext.Current.Server.Execute(seminar.DetailsOverrideUrl, output);
                }
                catch
                {
                    if (errorPath != null)
                    {
                        HttpContext.Current.Server.Execute(errorPath, output);
                    }
                    else
                    {
                        output.Write("Could not find overriden details for seminar!");
                    }
                }
            }
            else if (seminar.Details.Length > 0)
            {
                output.Write(seminar.Details);
            }
            else
            {
                output.Write("<b>No details were specified for this seminar.</b>");
            }

            output.WriteEndTag("td");
            output.WriteEndTag("tr");
            output.WriteEndTag("table");
        }