Esempio n. 1
0
        private void RenderRowHeader(HtmlTextWriter output, Day d)
        {
            BeforeHeaderRenderEventArgs ea = new BeforeHeaderRenderEventArgs();
            ea.Columns = d.Columns;
            ea.InnerHTML = d.Name;
            ea.Name = d.Name;
            ea.Value = d.Value;
            ea.DataItem = d.DataItem;

            while (ea.Columns.Count < HeaderColumns.Count)
            {
                ea.Columns.Add(new ResourceColumn(String.Empty));
            }

            DoBeforeResHeaderRender(ea);

            int height = (d.MaxColumns() * EventHeight);
            if (!CssOnly)
            {
                height -= 1;
            }

            output.AddStyleAttribute("width", (RowHeaderWidthResolved) + "px");

            if (!CssOnly)
            {
                output.AddStyleAttribute("border-right", "1px solid " + ColorTranslator.ToHtml(BorderColor));
                output.AddStyleAttribute("border-left", "1px solid " + ColorTranslator.ToHtml(BorderColor));
                output.AddStyleAttribute("border-bottom", "1px solid " + ColorTranslator.ToHtml(BorderColor));
                output.AddStyleAttribute("background-color", ColorTranslator.ToHtml(HourNameBackColor));
                output.AddStyleAttribute("font-family", HeaderFontFamily);
                output.AddStyleAttribute("font-size", HeaderFontSize);
                output.AddStyleAttribute("color", ColorTranslator.ToHtml(HeaderFontColor));
                output.AddStyleAttribute("cursor", "default");
            }

            output.AddAttribute("unselectable", "on");
            output.AddAttribute("resource", d.Value);
            output.AddAttribute("id", ClientID + "row" + d.Value);
            output.RenderBeginTag("td");

            if (RowHeaderColumns.Count > 0)
            {
                if (!CssOnly)
                {
                    output.Write("<div unselectable='on' style='height:" + height + "px; line-height:" + height + "px; overflow:hidden; width: " + RowHeaderWidthResolved + "px'>");
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<table style='width:" + (RowHeaderColumnWidthTotal) + "px; padding: 0px; border-spacing: 0px; table-layout: fixed;'>");
                    sb.Append("<tr>");
                    sb.Append("<td style='width:" + RowHeaderColumns[0] + "px; padding: 0px; white-space: nowrap; overflow: hidden;'>");
                    sb.Append("<div>");
                    sb.Append(ea.InnerHTML);
                    sb.Append("</div>");
                    sb.Append("</td>");
                    for (int i = 1; i < RowHeaderColumns.Count; i++)
                    {
                        string html = null;
                        if (i <= d.Columns.Count)
                        {
                            html = d.Columns[i - 1].InnerHTML;
                        }

                        sb.Append("<td style='width:" + RowHeaderColumns[i] + "px; padding: 0px; white-space: nowrap;overflow: hidden;'>");
                        sb.Append(html);
                        sb.Append("</td>");
                    }
                    sb.Append("</tr>");
                    sb.Append("</table>");

                    output.Write(sb.ToString());

                }
                else
                {
                    output.Write("<div unselectable='on' style='height:" + height + "px; line-height:" + height + "px; overflow:hidden; width: " + RowHeaderWidthResolved + "px'>");
                    StringBuilder sb = new StringBuilder();
                    sb.Append("<table style='width:" + (RowHeaderColumnWidthTotal) + "px; padding: 0px; border-spacing: 0px; table-layout: fixed;'>");
                    sb.Append("<tr>");
                    sb.Append("<td style='width:" + RowHeaderColumns[0] + "px; padding: 0px; overflow: hidden;'>");

                    sb.Append("<div unselectable='on' style='height:" + height + "px; overflow:hidden; position: relative;' class='" + PrefixCssClass("_rowheader") + "'>");
                    sb.Append("<div unselectable='on' class='" + PrefixCssClass("_rowheader_inner") + "'>");
                    sb.Append(ea.InnerHTML);
                    sb.Append("</div>");

                    sb.Append("</td>");
                    for (int i = 1; i < RowHeaderColumns.Count; i++)
                    {
                        string html = null;
                        if (i <= d.Columns.Count)
                        {
                            html = d.Columns[i - 1].InnerHTML;
                        }

                        sb.Append("<td style='width:" + RowHeaderColumns[i] + "px; padding: 0px; white-space: nowrap;overflow: hidden;'>");

                        sb.Append("<div unselectable='on' style='height:" + height + "px; overflow:hidden; position: relative;' class='" + PrefixCssClass("_rowheader") + "'>");
                        sb.Append("<div unselectable='on' class='" + PrefixCssClass("_rowheader_inner") + "'>");
                        sb.Append(html);
                        sb.Append("</div>");

                        sb.Append("</td>");
                    }
                    sb.Append("</tr>");
                    sb.Append("</table>");

                    output.Write(sb.ToString());
                }
            }
            else
            {
                if (!CssOnly)
                {
                    output.Write("<div unselectable='on' style='margin-left:4px; height:" + height + "px; line-height:" + height + "px; overflow:hidden;'>");
                    output.Write(ea.InnerHTML);
                }
                else
                {
                    output.Write("<div unselectable='on' style='height:" + height + "px; overflow:hidden; position: relative;' class='" + PrefixCssClass("_rowheader") + "'>");
                    output.Write("<div unselectable='on' class='" + PrefixCssClass("_rowheader_inner") + "'>");
                    output.Write(ea.InnerHTML);
                    output.Write("</div>");
                }
            }

            output.Write("</div>");

            output.RenderEndTag();
        }
Esempio n. 2
0
 private void DoBeforeResHeaderRender(BeforeHeaderRenderEventArgs args)
 {
     if (BeforeResHeaderRender != null)
     {
         BeforeResHeaderRender(this, args);
     }
 }