public override void Render(HtmlMobileTextWriter writer)
        {
            String additionalStyle;

            Alignment alignment = (Alignment)Style[Style.AlignmentKey, true];
            Wrapping  wrapping  = (Wrapping)Style[Style.WrappingKey, true];
            bool      wrap      = (wrapping == Wrapping.Wrap || wrapping == Wrapping.NotSet);
            String    width     = DesignerAdapterUtil.GetWidth(Control);

            ((DesignerTextWriter)writer).EnterZeroFontSizeTag();
            writer.EnterLayout(Style);
            writer.WriteBeginTag("div");
            if (!wrap)
            {
                byte templateStatus;
                int  maxWidth = DesignerAdapterUtil.GetMaxWidthToFit(Control, out templateStatus);
                if (templateStatus == DesignerAdapterUtil.CONTROL_IN_TEMPLATE_EDIT)
                {
                    width = maxWidth.ToString(CultureInfo.InvariantCulture) + "px";
                }
                additionalStyle = "overflow-x:hidden;width:" + width + ";";
            }
            else
            {
                additionalStyle = "word-wrap:break-word;width:" + width + ";";
            }

            ((DesignerTextWriter)writer).WriteStyleAttribute(Style, additionalStyle);
            if (alignment != Alignment.NotSet)
            {
                writer.WriteAttribute("align", Enum.GetName(typeof(Alignment), alignment));
            }
            writer.Write(">");

            writer.WriteText(Control.HeaderText, true);

            writer.WriteFullBeginTag("ul");
            for (int i = 1; i <= 2; i++)
            {
                writer.WriteFullBeginTag("li");
                writer.Write(SR.GetString(SR.ValidationSummary_ErrorMessage, i.ToString(CultureInfo.InvariantCulture)));
                writer.WriteEndTag("li");
            }
            writer.WriteEndTag("ul");

            writer.WriteBeginTag("a");
            writer.WriteAttribute("href", "NavigationUrl");
            writer.Write(">");
            writer.WriteText(String.IsNullOrEmpty(Control.BackLabel) ? GetDefaultLabel(BackLabel) : Control.BackLabel, true);
            writer.WriteEndTag("a");

            writer.WriteEndTag("div");
            writer.ExitLayout(Style);
            ((DesignerTextWriter)writer).ExitZeroFontSizeTag();
        }
 public virtual void RenderForm(HtmlMobileTextWriter writer, Form form)
 {
     writer.BeginFile(GetFormUrl(form), "text/html", Page.Response.Charset);
     writer.WriteFullBeginTag("html");
     form.RenderControl(writer);
     if (Device.RequiresDBCSCharacter)
     {
         // Insert a comment with a space
         writer.Write("<!--\u3000-->");
     }
     writer.WriteEndTag("html");
     writer.EndFile();
 }
        /// <include file='doc\HtmlSelectionListAdapter.uex' path='docs/doc[@for="HtmlSelectionListAdapter.Render"]/*' />
        public override void Render(HtmlMobileTextWriter writer)
        {
            MobileListItemCollection items      = Control.Items;
            ListSelectType           selectType = Control.SelectType;

            if (items.Count == 0 &&
                selectType != ListSelectType.ListBox &&
                selectType != ListSelectType.MultiSelectListBox)
            {
                return;
            }

            int    selectedIndex = Control.SelectedIndex;
            String renderName;

            if (Device.RequiresAttributeColonSubstitution)
            {
                renderName = Control.UniqueID.Replace(':', ',');
            }
            else
            {
                renderName = Control.UniqueID;
            }

            switch (selectType)
            {
            case ListSelectType.DropDown:
            case ListSelectType.ListBox:
            case ListSelectType.MultiSelectListBox:

                if (items.Count == 0 && !Device.CanRenderEmptySelects)
                {
                    break;
                }

                writer.EnterLayout(Style);
                writer.WriteBeginTag("select");

                if (selectType == ListSelectType.MultiSelectListBox)
                {
                    writer.Write(" multiple");
                }

                if (selectType == ListSelectType.ListBox || selectType == ListSelectType.MultiSelectListBox)
                {
                    writer.WriteAttribute("size", Control.Rows.ToString(CultureInfo.InvariantCulture));
                }

                writer.WriteAttribute("name", renderName);
                writer.Write(">");

                for (int itemIndex = 0; itemIndex < items.Count; itemIndex++)
                {
                    MobileListItem item = items[itemIndex];
                    writer.WriteBeginTag("option");
                    WriteItemValueAttribute(writer, itemIndex, item.Value);
                    if (item.Selected && (Control.IsMultiSelect || itemIndex == selectedIndex))
                    {
                        writer.Write(" selected>");
                    }
                    else
                    {
                        writer.Write(">");
                    }
                    writer.WriteEncodedText(item.Text);
                    writer.WriteLine("");
                }
                writer.Write("</select>");

                if (Device.HidesRightAlignedMultiselectScrollbars &&
                    selectType == ListSelectType.MultiSelectListBox)
                {
                    // nested if for perf
                    if ((Alignment)Style[Style.AlignmentKey, true] == Alignment.Right)
                    {
                        writer.Write("&nbsp;&nbsp;&nbsp;&nbsp;");
                    }
                }
                writer.WriteLine("");

                if (!Page.DesignMode)
                {
                    writer.ExitLayout(Style, Control.BreakAfter);
                }
                else
                {
                    writer.ExitLayout(Style, false);
                }
                break;

            case ListSelectType.Radio:
            case ListSelectType.CheckBox:

                String selectTypeString =
                    (selectType == ListSelectType.Radio) ?
                    "radio" :
                    "checkbox";
                Alignment alignment = (Alignment)Style[Style.AlignmentKey, true];
                if (!Device.Tables || alignment == Alignment.Left || alignment == Alignment.NotSet)
                {
                    writer.EnterStyle(Style);
                    bool breakAfter = false;
                    for (int itemIndex = 0; itemIndex < items.Count; itemIndex++)
                    {
                        if (breakAfter)
                        {
                            writer.WriteBreak();
                        }
                        MobileListItem item = items[itemIndex];

                        writer.WriteBeginTag("input");
                        writer.WriteAttribute("type", selectTypeString);
                        writer.WriteAttribute("name", renderName);
                        WriteItemValueAttribute(writer, itemIndex, item.Value);
                        if (item.Selected &&
                            (Control.IsMultiSelect || itemIndex == selectedIndex) &&
                            Device.SupportsUncheck)
                        {
                            writer.Write(" checked>");
                        }
                        else
                        {
                            writer.Write(">");
                        }
                        writer.WriteEncodedText(item.Text);
                        breakAfter = true;
                    }
                    writer.ExitStyle(Style, Control.BreakAfter);
                }
                else     // Device supports tables and alignment is non default.
                {
                    Wrapping wrapping = (Wrapping)Style[Style.WrappingKey, true];
                    bool     nowrap   = (wrapping == Wrapping.NoWrap);

                    writer.EnterLayout(Style);
                    writer.WriteFullBeginTag("table");
                    writer.BeginStyleContext();
                    for (int itemIndex = 0; itemIndex < items.Count; itemIndex++)
                    {
                        MobileListItem item = items[itemIndex];
                        writer.WriteFullBeginTag("tr");
                        writer.WriteBeginTag("td");
                        if (nowrap)
                        {
                            writer.WriteAttribute("nowrap", "true");
                        }
                        writer.Write(">");

                        writer.WriteBeginTag("input");
                        writer.WriteAttribute("type", selectTypeString);
                        writer.WriteAttribute("name", renderName);
                        WriteItemValueAttribute(writer, itemIndex, item.Value);
                        if (item.Selected &&
                            (Control.IsMultiSelect || itemIndex == selectedIndex) &&
                            Device.SupportsUncheck)
                        {
                            writer.Write(" checked>");
                        }
                        else
                        {
                            writer.Write(">");
                        }

                        writer.MarkStyleContext();
                        writer.EnterFormat(Style);
                        writer.WriteEncodedText(item.Text);
                        writer.ExitFormat(Style);
                        writer.UnMarkStyleContext();
                        writer.WriteEndTag("td");
                        writer.WriteEndTag("tr");
                    }
                    writer.WriteEndTag("table");
                    writer.EndStyleContext();
                    writer.ExitFormat(Style, Control.BreakAfter);
                }
                break;
            }
        }
        /// <include file='doc\HtmlSelectionListAdapter.uex' path='docs/doc[@for="HtmlSelectionListAdapter.Render"]/*' />
        public override void Render(HtmlMobileTextWriter writer)
        {
            MobileListItemCollection items = Control.Items;
            ListSelectType selectType = Control.SelectType;

            if (items.Count == 0 && 
                selectType != ListSelectType.ListBox && 
                selectType != ListSelectType.MultiSelectListBox)
            {
                return;
            }
            
            int selectedIndex = Control.SelectedIndex;
            String renderName;
            if(Device.RequiresAttributeColonSubstitution)
            {
                renderName = Control.UniqueID.Replace(':', ',');
            }
            else
            {
                renderName = Control.UniqueID;
            }

            switch(selectType)
            {
                case ListSelectType.DropDown:
                case ListSelectType.ListBox:
                case ListSelectType.MultiSelectListBox:

                    if (items.Count == 0 && !Device.CanRenderEmptySelects)
                    {
                        break;
                    }

                    writer.EnterLayout(Style);
                    writer.WriteBeginTag("select");

                    if (selectType == ListSelectType.MultiSelectListBox)
                    {
                        writer.Write(" multiple");
                    }

                    if (selectType == ListSelectType.ListBox || selectType == ListSelectType.MultiSelectListBox)
                    {
                        writer.WriteAttribute("size", Control.Rows.ToString(CultureInfo.InvariantCulture));
                    }

                    writer.WriteAttribute("name", renderName);
                    writer.Write(">");

                    for(int itemIndex = 0; itemIndex < items.Count; itemIndex++)
                    {
                        MobileListItem item = items[itemIndex];
                        writer.WriteBeginTag("option");
                        WriteItemValueAttribute(writer, itemIndex, item.Value);
                        if (item.Selected && (Control.IsMultiSelect || itemIndex == selectedIndex))
                        {
                            writer.Write(" selected>");
                        }
                        else
                        {
                            writer.Write(">");
                        }
                        writer.WriteEncodedText(item.Text);
                        writer.WriteLine("");
                    }
                    writer.Write("</select>");
            
                    if(Device.HidesRightAlignedMultiselectScrollbars &&
                        selectType == ListSelectType.MultiSelectListBox)
                    {
                        // nested if for perf
                        if((Alignment)Style[Style.AlignmentKey, true] == Alignment.Right)
                        {                                                
                            writer.Write("&nbsp;&nbsp;&nbsp;&nbsp;");
                        }
                    }
                    writer.WriteLine("");
                    
                    if (!Page.DesignMode)
                    {
                        writer.ExitLayout(Style, Control.BreakAfter);
                    }
                    else
                    {
                        writer.ExitLayout(Style, false);
                    }
                    break;

                case ListSelectType.Radio:
                case ListSelectType.CheckBox:

                    String selectTypeString =
                        (selectType == ListSelectType.Radio) ?
                        "radio" :
                        "checkbox";
                    Alignment alignment = (Alignment)Style[Style.AlignmentKey, true];
                    if(!Device.Tables || alignment == Alignment.Left || alignment == Alignment.NotSet)
                    {
                        writer.EnterStyle(Style);
                        bool breakAfter = false;
                        for(int itemIndex = 0; itemIndex < items.Count; itemIndex++)
                        {
                            if(breakAfter)
                            {
                                writer.WriteBreak();
                            }
                            MobileListItem item = items[itemIndex];

                            writer.WriteBeginTag("input");
                            writer.WriteAttribute("type", selectTypeString);
                            writer.WriteAttribute("name", renderName);
                            WriteItemValueAttribute(writer, itemIndex, item.Value);
                            if (item.Selected && 
                                (Control.IsMultiSelect || itemIndex == selectedIndex) &&
                                Device.SupportsUncheck)
                            {
                                writer.Write(" checked>");
                            }
                            else
                            {
                                writer.Write(">");
                            }
                            writer.WriteEncodedText(item.Text);
                            breakAfter = true;
                        }
                        writer.ExitStyle(Style, Control.BreakAfter);
                    }
                    else // Device supports tables and alignment is non default.
                    {
                        Wrapping  wrapping  = (Wrapping) Style[Style.WrappingKey , true];
                        bool nowrap = (wrapping == Wrapping.NoWrap);

                        writer.EnterLayout(Style);
                        writer.WriteFullBeginTag("table");
                        writer.BeginStyleContext();
                        for(int itemIndex = 0; itemIndex < items.Count; itemIndex++)
                        {
                            MobileListItem item = items[itemIndex];
                            writer.WriteFullBeginTag("tr");
                            writer.WriteBeginTag("td");
                            if(nowrap)
                            {
                                writer.WriteAttribute("nowrap","true");
                            }
                            writer.Write(">");

                            writer.WriteBeginTag("input");
                            writer.WriteAttribute("type", selectTypeString);
                            writer.WriteAttribute("name", renderName);
                            WriteItemValueAttribute(writer, itemIndex, item.Value);
                            if (item.Selected && 
                                (Control.IsMultiSelect || itemIndex == selectedIndex) &&
                                Device.SupportsUncheck)
                            {
                                writer.Write(" checked>");
                            }
                            else
                            {
                                writer.Write(">");
                            }

                            writer.MarkStyleContext();
                            writer.EnterFormat(Style);
                            writer.WriteEncodedText(item.Text);
                            writer.ExitFormat(Style);
                            writer.UnMarkStyleContext();
                            writer.WriteEndTag("td");
                            writer.WriteEndTag("tr");
                        }
                        writer.WriteEndTag("table");
                        writer.EndStyleContext();
                        writer.ExitFormat(Style, Control.BreakAfter);
                    }
                break;
            }
        }
示例#5
0
        internal void Transition(WriterStyle newStyle, bool captureOutput)
        {
            HtmlMobileTextWriter tempWriter = _writer;

            try
            {
                if (!captureOutput)
                {
                    tempWriter = _writer;
                    _writer    = new HtmlMobileTextWriter(
                        new HtmlTextWriter(new StringWriter(CultureInfo.InvariantCulture)), tempWriter.Device);
                }

                if (_inTransition)
                {
                    return;
                }
                else
                {
                    _inTransition = true;
                }

                if (Count == 0)
                {
                    while (_tagsWritten.Count > 0)
                    {
                        CloseTag();
                    }
                    _inTransition = false;
                    return;
                }

                //close italic if target format !italic
                if ((_current.Italic && !newStyle.Italic) && (_writer.RenderItalic))
                {
                    while (_current.Italic)
                    {
                        CloseTag();
                    }
                }

                //close bold if target format !bold
                if ((_current.Bold && !newStyle.Bold) && (_writer.RenderBold))
                {
                    while (_current.Bold)
                    {
                        CloseTag();
                    }
                }

                //if the target FontColor is Color.Empty, then we need to
                //close all open color tags
                if (
                    (newStyle.FontColor == Color.Empty) &&
                    (_current.FontColor != Color.Empty) &&
                    (_writer.RenderFontColor))
                {
                    while (_current.FontColor != Color.Empty)
                    {
                        CloseTag();
                    }
                }

                //if the target FontName is String.Empty, then we need to
                //close all open name tags
                if (
                    (newStyle.FontName != null && newStyle.FontName.Length == 0) &&
                    (_current.FontName == null || _current.FontName.Length > 0) &&
                    (_writer.RenderFontName))
                {
                    while (_current.FontName == null || _current.FontName.Length > 0)
                    {
                        CloseTag();
                    }
                }

                //close the font if it is of the same or a later generation
                //and differs

                bool newFont = FontChange(newStyle);

                if (newFont)
                {
                    while (FontLevel >= Count)
                    {
                        CloseTag();
                    }
                }

                //if the new wrapping is Wrap, and the current is NoWrap
                //the outer NoWrap must be removed
                if (
                    (newStyle.Wrapping == Wrapping.Wrap) &&
                    (_current.Wrapping == Wrapping.NoWrap) &&
                    (_writer.RenderDivNoWrap))
                {
                    while (_current.Wrapping != Wrapping.Wrap)
                    {
                        CloseTag();
                    }
                }
                //if the alignment differs for the same generation, close any divs at this level
                if ((newStyle.Alignment != _current.Alignment) && (_writer.RenderDivAlign))
                {
                    while (DivLevel >= Count)
                    {
                        CloseTag();
                    }
                }

                //determine if we will be opening a div before writing any break
                bool newDiv = DivChange(newStyle);

                //an opening div will function as a logical break
                if ((BreakPending) && (!(newDiv)))
                {
                    ((HtmlMobileTextWriter)_writer).WriteBreak();
                    BreakPending = false;
                }

                if (newDiv)
                {
                    while (_current.Bold || _current.Italic || (FontLevel == Count))
                    {
                        CloseTag();
                    }
                }

                newFont = FontChange(newStyle);
                newDiv  = DivChange(newStyle);

                //open div
                if (newDiv && newStyle.Layout)
                {
                    DivStyleTag div = new DivStyleTag(Count);
                    BreakPending = false;
                    if (
                        ((_writer.BeforeFirstControlWritten) || (_writer.InputWritten)) &&
                        (_writer.Device.Type == _pocketPC) &&
                        (_writer.Device.MinorVersion == 0) &&
                        (_writer.Device.MajorVersion == 4) &&
                        (newStyle.Alignment != _current.Alignment))
                    {
                        _writer.WriteBreak();
                        _writer.InputWritten = false;
                    }


                    _writer.WriteBeginTag("div");
                    DivLevel = Count;

                    if (newStyle.Wrapping == Wrapping.NoWrap)
                    {
                        if (_writer.RenderDivNoWrap)
                        {
                            _writer.Write(" nowrap");
                        }
                        div.Wrapping      = Wrapping.NoWrap;
                        _current.Wrapping = Wrapping.NoWrap;
                    }
                    else
                    {
                        div.Wrapping      = Wrapping.Wrap;
                        _current.Wrapping = Wrapping.Wrap;
                    }

                    if (newStyle.Alignment != _current.Alignment)
                    {
                        if (_writer.RenderDivAlign)
                        {
                            _writer.WriteAttribute(
                                "align",
                                Enum.GetName(typeof(Alignment), newStyle.Alignment));
                        }
                        _current.Alignment   = newStyle.Alignment;
                        div.Alignment        = newStyle.Alignment;
                        div.AlignmentWritten = true;
                    }
                    _tagsWritten.Push(div);
                    _writer.Write(">");
                }

                //open font
                if (newFont && newStyle.Format)
                {
                    FontStyleTag fontTag = new FontStyleTag(Count);
                    _writer.WriteBeginTag("font");
                    if (_current.FontSize != newStyle.FontSize)
                    {
                        String relativeSize;
                        if (newStyle.FontSize == FontSize.Large)
                        {
                            relativeSize = (
                                ((HtmlMobileTextWriter)_writer).Device.Type == _pocketPC) ? "+2" : "+1";
                            _current.FontSize = FontSize.Large;
                            fontTag.FontSize  = FontSize.Large;
                        }
                        else if (newStyle.FontSize == FontSize.Small)
                        {
                            relativeSize      = "-1";
                            _current.FontSize = FontSize.Small;
                            fontTag.FontSize  = FontSize.Small;
                        }
                        else //(newStyle.FontSize == FontSize.Normal)
                        {
                            relativeSize      = "+0";
                            _current.FontSize = FontSize.Normal;
                            fontTag.FontSize  = FontSize.Normal;
                        }
                        if (_writer.RenderFontSize)
                        {
                            _writer.WriteAttribute("size", relativeSize);
                        }
                    }

                    if (_current.FontColor != newStyle.FontColor)
                    {
                        if (_writer.RenderFontColor)
                        {
                            _writer.WriteAttribute(
                                "color",
                                ColorTranslator.ToHtml(newStyle.FontColor));
                        }
                        _current.FontColor = newStyle.FontColor;
                        fontTag.Color      = newStyle.FontColor;
                    }
                    if (_current.FontName != newStyle.FontName)
                    {
                        if (_writer.RenderFontName)
                        {
                            _writer.WriteAttribute("face", newStyle.FontName);
                        }
                        _current.FontName = newStyle.FontName;
                        fontTag.Name      = newStyle.FontName;
                    }
                    _writer.Write(">");
                    _tagsWritten.Push(fontTag);
                    FontLevel = Count;
                }

                //open bold
                if (newStyle.Format)
                {
                    if (newStyle.Bold && !_current.Bold && _writer.RenderBold)
                    {
                        _writer.WriteFullBeginTag("b");
                        _current.Bold = true;
                        _tagsWritten.Push(new BoldStyleTag(Count));
                    }

                    //open italic
                    if (newStyle.Italic && !_current.Italic && _writer.RenderItalic)
                    {
                        _writer.WriteFullBeginTag("i");
                        _current.Italic = true;
                        _tagsWritten.Push(new ItalicStyleTag(Count));
                    }
                }
                _inTransition = false;
            }
            finally
            {
                _writer = tempWriter;
            }
        }
        /// <include file='doc\HtmlFormAdapter.uex' path='docs/doc[@for="HtmlFormAdapter.Render"]/*' />
        public override void Render(HtmlMobileTextWriter writer)
        {
            Color  backColor    = (Color)Style[Style.BackColorKey, true];
            String title        = Control.Title;
            bool   isTitleEmpty = String.IsNullOrEmpty(title);

            bool willWriteHeadElements =
                !isTitleEmpty ||
                RenderExtraHeadElements(null);

            if (willWriteHeadElements)
            {
                writer.Write("\r\n");
                writer.WriteFullBeginTag("head");
            }

            if (!isTitleEmpty)
            {
                writer.Write("\r\n");
                writer.WriteFullBeginTag("title");
                writer.Write(title);
                writer.WriteEndTag("title");
                writer.Write("\r\n");
            }

            _renderPager = true;

            RenderExtraHeadElements(writer);

            if (willWriteHeadElements)
            {
                writer.WriteEndTag("head");
                writer.Write("\r\n");
            }

            IDictionary bodyAttributes = new ListDictionary();

            if ((backColor != Color.Empty) && (writer.RenderBodyColor))
            {
                bodyAttributes.Add("bgcolor", ColorTranslator.ToHtml(backColor));
            }
            RenderBodyTag(writer, bodyAttributes);

            bool formTagRequired = ShouldRenderFormTag();

            if (formTagRequired)
            {
                writer.WriteBeginTag("form");
                writer.WriteAttribute("id", Control.ClientID);
                writer.WriteAttribute("name", Control.ClientID);
                writer.WriteAttribute("method", Control.Method.ToString().ToLower(CultureInfo.InvariantCulture));
                writer.Write(" action=\"");

                if (Control.Action.Length > 0)
                {
                    // AUI 3652
                    String url = Control.ResolveUrl(Control.Action);

                    if (!Device.SupportsQueryStringInFormAction)
                    {
                        // If query string is not supported, we don't write
                        // it here, and the query string will be added as
                        // hidden variables later.
                        int i = url.IndexOf('?');
                        if (i != -1)
                        {
                            url = url.Substring(0, i);
                        }
                    }

                    writer.Write(url);
                }
                else
                {
                    writer.WriteEncodedUrl(Page.RelativeFilePath);

                    if (Device.SupportsQueryStringInFormAction)
                    {
                        writer.Write("?");
                        writer.Write(Page.UniqueFilePathSuffix);
                        if (Control.Method != FormMethod.Get)
                        {
                            String queryStringText = Page.QueryStringText;
                            if (queryStringText != null && queryStringText.Length > 0)
                            {
                                writer.Write('&');
                                writer.Write(queryStringText);
                            }
                        }
                    }
                }

                writer.Write("\"");
                writer.Write(">\r\n");

                PageAdapter.RenderPostBackHeader(writer, Control);

                // Renders hidden variables for IPostBackDataHandlers which are
                // not displayed due to pagination or secondary UI.
                RenderOffPageVariables(writer, Control, Control.CurrentPage);
            }

            writer.EnterStyle(Style);

            writer.BeforeFirstControlWritten = true;

            MobileControl secondaryUIControl = SecondaryUIControl as MobileControl;

            if (secondaryUIControl != null && secondaryUIControl.Form == Control)
            {
                bool secondaryUIInHeaderOrFooter = IsControlInFormHeader(secondaryUIControl) ||
                                                   IsControlInFormFooter(secondaryUIControl);


                SetControlPageRecursive(secondaryUIControl, -1);
                if (Control.Header != null && !secondaryUIInHeaderOrFooter)
                {
                    Control.Header.RenderControl(writer);
                }
                secondaryUIControl.RenderControl(writer);
                if (Control.Footer != null && !secondaryUIInHeaderOrFooter)
                {
                    Control.Footer.RenderControl(writer);
                }
            }
            else
            {
                bool pagerRendered = false;
                if (Control.HasControls())
                {
                    foreach (Control child in Control.Controls)
                    {
                        if (Control.Footer == child)
                        {
                            RenderPager(writer);
                            pagerRendered = true;
                        }
                        child.RenderControl(writer);
                    }
                }
                if (!pagerRendered)
                {
                    RenderPager(writer);
                }
            }

            writer.ExitStyle(Style, false);

            if (formTagRequired)
            {
                if (!Device.SupportsQueryStringInFormAction)
                {
                    // Add query string parameters at the end of the form if
                    // there are any
                    RenderQueryParametersAsHiddenFields(writer);
                }
                writer.WriteEndTag("form");
            }
            writer.WriteEndTag("body");
        }
        //*********************************************************************
        //
        // HtmlTabbedPanelAdapter.Render Method
        //
        // Renders the control. The TabbedPanel is rendered as one or more
        // rows of tabs that the user can click on to move between tabs.
        //
        //*********************************************************************
        public override void Render(HtmlMobileTextWriter writer)
        {
            IPanelPane activePane = Control.ActivePane;
            int tabsPerRow = Control.TabsPerRow;
            PanelPaneCollection panes = Control.Panes;
            int paneCount = panes.Count;

            // Figure out the number of visible panes.
            int[] visiblePanes = new int[paneCount];
            int visiblePaneCount = 0;
            for (int i = 0; i < paneCount; i++)
            {
                if (((Control) panes[i]).Visible)
                {
                    visiblePanes[visiblePaneCount++] = i;
                }
            }

            // Calculate how many rows are necessary.
            int rows = (visiblePaneCount + tabsPerRow - 1)/tabsPerRow;

            // make sure tabsPerRow doesn't exceed the number of visible panes
            tabsPerRow = (Control.TabsPerRow > visiblePaneCount) ? visiblePaneCount : Control.TabsPerRow;

            // Open the table.
            writer.WriteBeginTag("table");
            writer.WriteAttribute("cellspacing", "0");
            writer.WriteAttribute("cellpadding", "2");
            writer.WriteAttribute("border", "0");
            writer.WriteLine(">");

            for (int row = rows - 1; row >= 0; row--)
            {
                writer.WriteFullBeginTag("tr");
                writer.WriteLine();
                for (int col = 0; col < tabsPerRow; col++)
                {
                    writer.WriteBeginTag("td");
                    writer.WriteAttribute("width", "0");
                    writer.Write(">");
                    writer.WriteEndTag("td");

                    int i = row*tabsPerRow + col;
                    if (row > 0 && i >= visiblePaneCount)
                    {
                        writer.WriteFullBeginTag("td");
                        writer.WriteEndTag("td");
                        continue;
                    }

                    int index = visiblePanes[i];
                    IPanelPane child = panes[index];
                    if (child == activePane)
                    {
                        writer.WriteBeginTag("td");
                        writer.WriteAttribute("bgcolor", GetColorString(Control.ActiveTabColor, "#333333"));
                        writer.Write(">");

                        writer.WriteBeginTag("font");
                        writer.WriteAttribute("face", "Verdana");
                        writer.WriteAttribute("size", "-2");
                        writer.WriteAttribute("color", GetColorString(Control.ActiveTabTextColor, "#000000"));
                        writer.Write(">");

                        writer.WriteFullBeginTag("b");
                        writer.Write("&nbsp;");
                        writer.WriteText(child.Title, true);
                        writer.Write("&nbsp;");
                        writer.WriteEndTag("b");

                        writer.WriteEndTag("font");

                        writer.WriteEndTag("td");
                        writer.WriteLine();
                    }
                    else
                    {
                        writer.WriteBeginTag("td");
                        writer.WriteAttribute("bgcolor", GetColorString(Control.TabColor, "#cccccc"));
                        writer.Write(">");

                        writer.WriteBeginTag("font");
                        writer.WriteAttribute("face", "Verdana");
                        writer.WriteAttribute("size", "-2");
                        writer.WriteAttribute("color", GetColorString(Control.TabTextColor, "#000000"));
                        writer.Write(">");

                        writer.Write("&nbsp;");
                        writer.WriteBeginTag("a");
                        RenderPostBackEventAsAttribute(writer, "href", index.ToString());
                        writer.Write(">");
                        writer.WriteText(child.Title, true);
                        writer.WriteEndTag("a");
                        writer.Write("&nbsp;");

                        writer.WriteEndTag("font");

                        writer.WriteEndTag("td");
                        writer.WriteLine();
                    }
                }
                writer.WriteEndTag("tr");
                writer.WriteLine();

                if (row > 0)
                {
                    writer.WriteFullBeginTag("tr");
                    writer.WriteBeginTag("td");
                    writer.WriteAttribute("height", "1");
                    writer.Write(">");
                    writer.WriteEndTag("td");
                    writer.WriteEndTag("tr");
                    writer.WriteLine();
                }
            }

            writer.WriteEndTag("table");
            writer.WriteLine();

            writer.WriteBeginTag("table");
            writer.WriteAttribute("width", "100%");
            writer.WriteAttribute("height", "2");
            writer.WriteAttribute("border", "0");
            writer.WriteAttribute("cellspacing", "0");
            writer.WriteAttribute("bgcolor", "#000000");
            writer.Write(">");
            writer.WriteFullBeginTag("tr");
            writer.WriteFullBeginTag("td");
            writer.WriteEndTag("td");
            writer.WriteEndTag("tr");
            writer.WriteEndTag("table");
            writer.WriteBreak();

            ((Control) activePane).RenderControl(writer);
        }