Ejemplo n.º 1
0
        void WriteCaption(HtmlTextWriter writer)
        {
            if (CaptionAlign != TableCaptionAlign.NotSet)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Align, CaptionAlign.ToString(Helpers.InvariantCulture));
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Caption);
            writer.Write(Caption);
            writer.RenderEndTag();
        }
Ejemplo n.º 2
0
        void RenderHoriz(HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
        {
            int itms = user.RepeatedItemCount;
            // total number of rows/columns in our table
            int cols = RepeatColumns == 0 ? itms : RepeatColumns;
            // this gets ceil (itms / cols)
            int  rows = cols == 0 ? 0 : (itms + cols - 1) / cols;
            bool sep  = user.HasSeparators;
            //bool oti = OuterTableImplied;
            int hdr_span = cols * (sep ? 2 : 1);

            bool table = RepeatLayout == RepeatLayout.Table;
            bool show_empty_trailing_items = true;
            bool show_empty_trailing_sep   = true;

            RenderBeginTag(w, controlStyle, baseControl);

            if (Caption.Length > 0)
            {
                if (CaptionAlign != TableCaptionAlign.NotSet)
                {
                    w.AddAttribute(HtmlTextWriterAttribute.Align, CaptionAlign.ToString());
                }

                w.RenderBeginTag(HtmlTextWriterTag.Caption);
                w.Write(Caption);
                w.RenderEndTag();
            }

            // Render the header
            if (user.HasHeader)
            {
                if (table)
                {
                    w.RenderBeginTag(HtmlTextWriterTag.Tr);
                    // Make sure the header takes up the full width. We have two
                    // columns per item if we are using separators, otherwise
                    // one per item.
                    if (hdr_span != 1)
                    {
                        w.AddAttribute(HtmlTextWriterAttribute.Colspan, hdr_span.ToString(), false);
                    }

                    if (UseAccessibleHeader)
                    {
                        w.AddAttribute("scope", "col", false);
                    }

                    Style s = user.GetItemStyle(ListItemType.Header, -1);
                    if (s != null)
                    {
                        s.AddAttributesToRender(w);
                    }

                    if (UseAccessibleHeader)
                    {
                        w.RenderBeginTag(HtmlTextWriterTag.Th);
                    }
                    else
                    {
                        w.RenderBeginTag(HtmlTextWriterTag.Td);
                    }

                    user.RenderItem(ListItemType.Header, -1, this, w);
                    w.RenderEndTag();                      // td
                    w.RenderEndTag();                      // tr
                }
                else
                {
                    user.RenderItem(ListItemType.Header, -1, this, w);
                    if (!table && RepeatColumns != 0 && itms != 0)
                    {
                        RenderBr(w);
                    }
                }
            }

            for (int r = 0; r < rows; r++)
            {
                if (table)
                {
                    w.RenderBeginTag(HtmlTextWriterTag.Tr);
                }

                for (int c = 0; c < cols; c++)
                {
                    // Find the item number we are in according to the repeat
                    // direction.
                    int item = r * cols + c;

                    // This item is blank because there there not enough items
                    // to make a full row.
                    if (!show_empty_trailing_items && item >= itms)
                    {
                        continue;
                    }

                    if (table)
                    {
                        Style s = null;
                        if (item < itms)
                        {
                            s = user.GetItemStyle(ListItemType.Item, item);
                        }

                        if (s != null)
                        {
                            s.AddAttributesToRender(w);
                        }
                        w.RenderBeginTag(HtmlTextWriterTag.Td);
                    }

                    if (item < itms)
                    {
                        user.RenderItem(ListItemType.Item, item, this, w);
                    }

                    if (table)
                    {
                        w.RenderEndTag();                          // td
                    }
                    if (sep)
                    {
                        if (table)
                        {
                            if (item < itms - 1)
                            {
                                Style s = user.GetItemStyle(ListItemType.Separator, item);
                                if (s != null)
                                {
                                    s.AddAttributesToRender(w);
                                }
                            }
                            if (item < itms - 1 || show_empty_trailing_sep)
                            {
                                w.RenderBeginTag(HtmlTextWriterTag.Td);
                            }
                        }

                        if (item < itms - 1)
                        {
                            user.RenderItem(ListItemType.Separator, item, this, w);
                        }

                        if (table && (item < itms - 1 || show_empty_trailing_sep))
                        {
                            w.RenderEndTag();                              // td
                        }
                    }
                }

                if (table)
                {
                    //	if (!oti)
                    w.RenderEndTag();                              // tr
                }
                else if (!(r == rows - 1 && RepeatColumns == 0))
                {
                    RenderBr(w);
                }
            }

            // Render the footer
            if (user.HasFooter)
            {
                if (table)
                {
                    w.RenderBeginTag(HtmlTextWriterTag.Tr);
                    if (hdr_span != 1)
                    {
                        w.AddAttribute(HtmlTextWriterAttribute.Colspan, hdr_span.ToString(), false);
                    }

                    Style s = user.GetItemStyle(ListItemType.Footer, -1);
                    if (s != null)
                    {
                        s.AddAttributesToRender(w);
                    }

                    w.RenderBeginTag(HtmlTextWriterTag.Td);
                    user.RenderItem(ListItemType.Footer, -1, this, w);
                    w.RenderEndTag();                      // td
                    w.RenderEndTag();                      // tr
                }
                else
                {
                    user.RenderItem(ListItemType.Footer, -1, this, w);
                }
            }
            if (true)
            {
                w.RenderEndTag();                  // table/span
            }
        }
Ejemplo n.º 3
0
 void WriteCaption(HtmlTextWriter writer)
 {
     if (CaptionAlign != TableCaptionAlign.NotSet)
         writer.AddAttribute(HtmlTextWriterAttribute.Align, CaptionAlign.ToString(Helpers.InvariantCulture)); }