示例#1
0
 /// <summary>
 /// Gets Hyperlink for this slave-grid
 /// </summary>
 /// <param name="slaveGrid">SlaveGrid</param>
 /// <returns>returns null if grid is not found, else the hyperlink.</returns>
 public string GetSlaveGridAnchor(Grid slaveGrid)
 {
     if (!Contains(slaveGrid) || slaveGrid.MasterWebGrid == null)
     {
         return(null);
     }
     if (slaveGrid.MasterWebGrid.ActiveMenuSlaveGrid == slaveGrid)
     {
         return(Buttons.Anchor(slaveGrid.MasterWebGrid, slaveGrid.MenuText, "SlaveGridClick",
                               new[] { slaveGrid.ID }, null,
                               slaveGrid.MasterWebGrid.GetSystemMessage("ClickToCloseMenu"), "wgmenulinkactive",
                               null, true));
     }
     return(Buttons.Anchor(slaveGrid.MasterWebGrid, slaveGrid.MenuText, "SlaveGridClick", new[] { slaveGrid.ID },
                           null,
                           slaveGrid.MasterWebGrid.GetSystemMessage("ClickToActivateMenu"), "wgmenulinkinactive",
                           null, true));
 }
示例#2
0
        internal override void RenderLabelView(WebGridHtmlWriter writer, RowCell cell)
        {
            if (cell == null)
            {
                return;
            }
            switch (SystemColumnType)
            {
            case Enums.SystemColumn.PagerColumn:
                if (Grid.RecordCount > Grid.PageSize)
                {
                    return;
                }
                cell.Row.m_Table.m_Grid.PagerSettings.SliderOperation = System.Web.UI.WebControls.Orientation.Vertical;
                writer.Write(cell.Row.m_Table.m_Grid.PagerSettings.GetPager);
                cell.Row.m_Table.m_Grid.PagerSettings.PagerType = PagerType.None;
                break;

            case Enums.SystemColumn.SelectColumn:
                writer.Write(
                    SelectableRows.GetItemCheckbox(Grid, cell.Row.PrimaryKeyValues, string.Empty,
                                                   Grid.ColorToHtml(Grid.SelectRowColor)));
                break;

            case Enums.SystemColumn.DeleteColumn:
                if (cell.Row.AllowDelete == false)
                {
                    Visibility = Visibility.None;
                    Title      = null;
                }
                else
                {
                    string strConfirmDelete = Grid.GetSystemMessage("ConfirmDelete");
                    if (Html == null)
                    {
                        writer.Write(Buttons.Anchor(Grid, " ", "RecordDeleteClick",
                                                    new[] { cell.Row.PrimaryKeyValues }, strConfirmDelete,
                                                    Grid.GetSystemMessage("DeleteRow"), "ui-icon ui-icon-trash",
                                                    null, false));
                    }

                    else
                    {
                        writer.Write(
                            Buttons.TextButtonControl(Grid, Html, "RecordDeleteClick",
                                                      new[] { cell.Row.PrimaryKeyValues }, null,
                                                      strConfirmDelete));
                    }
                }
                break;

            case Enums.SystemColumn.SpacingColumn:
                WidthColumnHeaderTitle = System.Web.UI.WebControls.Unit.Empty;
                writer.Write("&nbsp;");
                break;

            case Enums.SystemColumn.CopyColumn:
                if (cell.Row.AllowCopy == false)
                {
                    Visibility = Visibility.None;
                    Title      = null;
                }
                else
                {
                    const string strConfirmCopy = null;
                    if (Html == null)
                    {
                        writer.Write(

                            Buttons.Anchor(Grid, " ", "RecordCopyClick",
                                           new[] { string.Empty, cell.Row.PrimaryKeyValues }, strConfirmCopy,
                                           Grid.GetSystemMessage("CopyRow"), "ui-icon ui-icon-copy",
                                           null, false));
                    }

                    else
                    {
                        writer.Write(
                            Buttons.TextButtonControl(Grid, Html, "RecordCopyClick",
                                                      new[] { string.Empty, cell.Row.PrimaryKeyValues }, null,
                                                      strConfirmCopy));
                    }
                }
                break;

            case Enums.SystemColumn.NewRecordColumn:
                if (Grid.AllowNew == false)
                {
                    Visibility = Visibility.None;
                    Title      = null;
                }
                else
                {
                    if (Html == null)
                    {
                        writer.Write(
                            Buttons.TextButtonControl(Grid, Grid.GetSystemMessage("NewRecord"), "NewRecordClick",
                                                      new string[] { },
                                                      Grid.GetSystemMessageClass("NewRecord", "wgnewrecord")));
                    }
                    else
                    {
                        writer.Write(
                            Buttons.TextButtonControl(Grid, Html, "NewRecordClick", new string[] { },
                                                      Grid.GetSystemMessageClass("NewRecord", "wgnewrecord")));
                    }
                }
                break;

            case Enums.SystemColumn.UpdateGridRecordsColumn:
                if (Grid.AllowUpdate == false)
                {
                    Visibility = Visibility.None;
                    Title      = null;
                }
                else
                {
                    if (Html == null)
                    {
                        writer.Write(
                            Buttons.TextButtonControl(Grid, Grid.GetSystemMessage("UpdateRows"), "UpdateRowsClick",
                                                      new string[] { },
                                                      Grid.GetSystemMessageClass("UpdateRows", "wgUpdateRows")));
                    }
                    else
                    {
                        writer.Write(
                            Buttons.TextButtonControl(Grid, Html, "UpdateRowsClick", new string[] { },
                                                      Grid.GetSystemMessageClass("UpdateRows", "wgUpdateRows")));
                    }
                }
                break;

            case Enums.SystemColumn.UpdateGridRecordColumn:
                if (Grid.AllowUpdate == false)
                {
                    Visibility = Visibility.None;
                    Title      = null;
                }
                else
                {
                    StringBuilder sb = new StringBuilder();
                    StringWriter  sw = new StringWriter(sb);
                    System.Web.UI.HtmlTextWriter textwriter = new System.Web.UI.HtmlTextWriter(sw);

                    if (Html == null)
                    {
                        textwriter.Write(Buttons.TextButtonControl(Grid, Grid.GetSystemMessage("UpdateRow"), "UpdateRowClick",
                                                                   new[] { cell.Row.PrimaryKeyValues },
                                                                   Grid.GetSystemMessageClass("UpdateRow", "wgUpdateRow")));
                    }
                    else
                    {
                        textwriter.Write(Buttons.TextButtonControl(Grid, Html, "UpdateRowClick",
                                                                   new[] { cell.Row.PrimaryKeyValues },
                                                                   Grid.GetSystemMessageClass("UpdateRow", "wgUpdateRow")));
                    }

                    writer.Write(sb);
                }
                break;
            }
            // base.RenderLabelView(writer,cell);
            RenderGrid(null, writer, cell);
        }
示例#3
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.PreRender"></see> event.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void RenderControl(TextWriter writer)
        {
            if (m_EventRanpreRender)
            {
                return;
            }
            m_EventRanpreRender = true;

            if (PagerType == PagerType.None || m_PagerGrid.PageSize >= m_PagerGrid.RecordCount)
            {
                return;
            }

            m_Pages = m_PagerGrid.PageSize == 0 ? 1 : (m_PagerGrid.RecordCount / m_PagerGrid.PageSize);
            if (m_PagerGrid.RecordCount % m_PagerGrid.PageSize != 0)
            {
                m_Pages++;
            }
            PreviousTemplate = string.Format(PreviousTemplate, ImagePath, m_PagerGrid.GetSystemMessage("Prev"));
            NextTemplate     = string.Format(NextTemplate, ImagePath, m_PagerGrid.GetSystemMessage("Next"));
            FirstTemplate    = string.Format(FirstTemplate, ImagePath, m_PagerGrid.GetSystemMessage("First"));
            LastTemplate     = string.Format(LastTemplate, ImagePath, m_PagerGrid.GetSystemMessage("Last"));

            writer.Write("<table class=\"wgpager\"><tr>");
            if (PagerType != PagerType.RangedSlider)
            {
                if (DisplayFirstLast /*&& !(PagerType == PagerType.DropDown && CompactDropDown)*/)
                {
                    writer.Write("<td>{0}</td>",
                                 Buttons.Anchor(m_PagerGrid, FirstTemplate, "PagerClick", new[] { "1" }, null,
                                                m_PagerGrid.GetSystemMessage("First"),
                                                m_PagerGrid.GetSystemMessageClass("First", "ui-icon ui-icon-seek-first"),
                                                null, false));
                }
                if (DisplayPreviousNext /*&& !(PagerType == PagerType.DropDown && CompactDropDown)*/)
                {
                    writer.Write("<td>{0}</td>",
                                 Buttons.Anchor(m_PagerGrid, PreviousTemplate, "PagerClick",
                                                new[] { (m_PagerGrid.PageIndex - 1).ToString() }, null,
                                                m_PagerGrid.GetSystemMessage("Prev"),
                                                "ui-icon ui-icon-seek-prev", null, false));
                }
            }
            switch (PagerType)
            {
            case PagerType.DropDown:
                writer.Write("<td>");
                writer.Write(CreateDropDownPager(DisplayAll));
                writer.Write("</td>");
                break;

            case PagerType.Slider:
            case PagerType.RangedSlider:
                writer.Write("<td>");
                writer.Write(CreateSlider());
                writer.Write("</td>");
                break;

            default:
                writer.Write(CreateBarPager(DisplayAll));
                break;
            }
            if (PagerType != PagerType.RangedSlider)
            {
                if (DisplayPreviousNext
                    /*&& !(PagerType == PagerType.DropDown && CompactDropDown)*/)
                {
                    int next = (m_PagerGrid.PageIndex + 1);
                    if (next > m_Pages)
                    {
                        next = m_Pages;
                    }
                    writer.Write("<td>{0}</td>",
                                 Buttons.Anchor(m_PagerGrid, NextTemplate, "PagerClick", new[] { (next).ToString() },
                                                null,
                                                m_PagerGrid.GetSystemMessage("Next"),
                                                m_PagerGrid.GetSystemMessageClass("Next", "ui-icon ui-icon-seek-next"),
                                                null,
                                                false));
                }
                if (DisplayFirstLast
                    /*&& !(PagerType == PagerType.DropDown && CompactDropDown)*/)
                {
                    writer.Write("<td>{0}</td>", Buttons.Anchor(m_PagerGrid, LastTemplate, "PagerClick",
                                                                new[] { m_Pages.ToString() }, null,
                                                                m_PagerGrid.GetSystemMessage("Last"),
                                                                m_PagerGrid.GetSystemMessageClass("Last",
                                                                                                  "ui-icon ui-icon-seek-end"),
                                                                null, false));
                }
            }
            writer.Write("</tr></table>");
        }
示例#4
0
        private string CreateBarPager(bool all)
        {
            StringBuilder bar = new StringBuilder(string.Empty);

            string preFix          = PageBarTemplate.Substring(0, PageBarTemplate.IndexOf("{0}"));
            string postFix         = PageBarTemplate.Substring(PageBarTemplate.IndexOf("{0}") + 3);
            string selectedPreFix  = SelectedPageBarTemplate.Substring(0, SelectedPageBarTemplate.IndexOf("{0}"));
            string selectedPostFix = SelectedPageBarTemplate.Substring(SelectedPageBarTemplate.IndexOf("{0}") + 3);

            int startIndex;

            if (NavigateStyle == NavigateStyle.Paging)
            {
                startIndex = (PagerSequence - 1) * PagerWidth + 1;
            }
            else
            {
                startIndex = m_PagerGrid.PageIndex - PagerWidth / 2;
                if (startIndex + PagerWidth > m_Pages)
                {
                    startIndex = m_Pages - PagerWidth + 1;
                }

                if (startIndex < 1)
                {
                    startIndex = 1;
                }
            }

            if (all)
            {
                string records = string.Format(" ({0:N0})", m_PagerGrid.RecordCount + 1);
                if (m_PagerGrid.PageIndex == 0)
                {
                    bar.AppendFormat("<td>{0}<span title=\"{2}\" class=\"wgpagerselected\">{3}{4}</span>{1}</td>",
                                     selectedPreFix, selectedPostFix, m_PagerGrid.GetSystemMessage("AllTitle"),
                                     m_PagerGrid.GetSystemMessage("All"), records);
                }
                else
                {
                    string textcontent = m_PagerGrid.RecordCount < 500
                                             ? Buttons.Anchor(m_PagerGrid, m_PagerGrid.GetSystemMessage("All") + records,
                                                              "PagerClick",
                                                              new[] { "ALL" }, null,
                                                              m_PagerGrid.GetSystemMessage("AllTitle"),
                                                              m_PagerGrid.GetSystemMessageClass("All", "wgpagerall"),
                                                              null, true)
                                             : Buttons.Anchor(m_PagerGrid, m_PagerGrid.GetSystemMessage("All") + records,
                                                              "PagerClick",
                                                              new[] { "ALL" },
                                                              string.Format(
                                                                  m_PagerGrid.GetSystemMessage("DisplayReords"),
                                                                  m_PagerGrid.RecordCount.ToString("N0")),
                                                              m_PagerGrid.GetSystemMessage("AllTitle"),
                                                              m_PagerGrid.GetSystemMessageClass("All", "wgpagerall"),
                                                              null, true);

                    bar.AppendFormat("<td>{0}{1}{2}</td>", preFix, textcontent, postFix);
                }
            }
            for (int i = startIndex; i <= NumberOfPagersToGenerate && i <= m_Pages; i++)
            {
                string strI = i.ToString();
                if (CurrentPageDigits > 0)
                {
                    strI = strI.PadLeft(CurrentPageDigits, "0"[0]);
                }

                if (i != m_PagerGrid.PageIndex)
                {
                    bar.AppendFormat("<td>{0}{1}{2}</td>", preFix,
                                     Buttons.Anchor(m_PagerGrid, strI, "PagerClick", new[] { i.ToString() }, null,
                                                    String.Format("{0}/{1}", i, m_Pages), "wgpagerunselected", null,
                                                    true), postFix);
                }
                else
                {
                    if (m_PagerGrid.IsUsingJQueryUICSSFramework)
                    {
                        bar.AppendFormat(
                            "<td>{0}<span class=\"wgpagerselected\"><button class=\"ui-button ui-state-default ui-state-disabled ui-corner-all\">{1}</button></span>{2}</td>",
                            selectedPreFix, strI,
                            selectedPostFix);
                    }
                    else
                    {
                        bar.AppendFormat("<td>{0}<span class=\"wgpagerselected\">{1}</span>{2}</td>", selectedPreFix,
                                         strI,
                                         selectedPostFix);
                    }
                }
            }
            return(bar.ToString());
        }
示例#5
0
        internal void RenderGrid(ref Grid grid, ref WebGridHtmlWriter writer)
        {
            string width = grid.Width.IsEmpty == false?grid.Width.ToString() : "100%";

            /* cellpadding and cellspacing are fixed because CSS does not support similar behavior*/
            if (grid.IsUsingJQueryUICSSFramework)
            {
                writer.Write(
                    "<table width=\"{0}\" id=\"{1}\" class=\"ui-widget-content\"  cellpadding=\"0\" cellspacing=\"0\">",
                    width, grid.ID);
            }
            else
            {
                writer.Write(
                    "<table width=\"{0}\" id=\"{1}\" cellpadding=\"0\" cellspacing=\"0\">",
                    width, grid.ID);
            }
            int[] sortedColumns = grid.VisibleSortedColumns;

            if (grid.RecordsPerRow == 1)
            {
                //extra table is to get rid of css background glitch in ie and safari.
                if (grid.IsUsingJQueryUICSSFramework)
                {
                    writer.Write("<thead class=\"ui-widget-header wgthead\">");
                }
                else
                {
                    writer.Write("<thead class=\"wgthead\">");
                }
            }

            CreateTitle(grid, DisplayView.Grid, writer, sortedColumns, 0, "th");

            if ((grid.CollapseIfSlaveGrid && grid.ActiveMenuSlaveGrid != null) || grid.CollapsedGrid)
            {
                if (grid.RecordsPerRow == 1)
                {
                    writer.Write("</thead></table>");
                }
                else
                {
                    writer.Write("</table>");
                }
                return;
            }
            if (grid.MasterTable.Columns.Primarykeys == null)
            {
                grid.AllowDelete = false;
                grid.AllowEdit   = false;
                grid.AllowNew    = false;
                grid.AllowCopy   = false;
            }
            if (string.IsNullOrEmpty(grid.GetToolbarHtml(ToolbarType.ToolbarGridTop)) == false)
            {
                if (grid.IsUsingJQueryUICSSFramework)
                {
                    writer.Write("<tr class=\"ui-widget-header wgrow\"><td colspan=\"{0}\" class=\"wgtoolbargrid\">",
                                 sortedColumns.Length);
                }
                else
                {
                    writer.Write("<tr class=\"wgrow\"><td colspan=\"{0}\" class=\"wgtoolbargrid\">",
                                 sortedColumns.Length);
                }
                CreateGridToolbar(grid.GetToolbarHtml(ToolbarType.ToolbarGridTop), writer, grid);
                writer.Write("</td></tr>");
            }
            // Show Header
            bool FilterByColumns = grid.MasterTable.Columns.Exists(delegate(Column column)
                                                                   { return(column.FilterByColumnCollection != null && column.FilterByColumnCollection.Count > 0); });

            // Create column filter
            if (FilterByColumns)
            {
                CreateFilterByColumns(grid, writer, sortedColumns);
            }
            // RENDER ROWS

            if (grid.DisplayHeader)
            {
                // CREATE HEADING
                writer.Write("<tr valign=\"bottom\" class=\"wgrow wggridheader\" id=\"{0}r0\">", grid.ID);

                for (int ii = 0; ii < sortedColumns.Length; ii++)
                {
                    Column column = grid.MasterTable.Columns[sortedColumns[ii]];

                    ColumnHeader addcolumn = new ColumnHeader
                    {
                        m_Class        = string.Format("{0} wgheadercell", column.CssClassTitle),
                        m_Align        = column.GridAlign,
                        m_VAlign       = VerticalPosition.bottom,
                        m_GridRowCount = (-1),
                        m_GridId       = grid.ID
                    };
                    if ((column.ColumnType == ColumnType.SystemColumn &&
                         ((WebGrid.SystemColumn)column).SystemColumnType == SystemColumn.SpacingColumn) ==
                        false)
                    {
                        if (column.WidthColumnHeaderTitle == Unit.Empty)
                        {
                            switch (column.ColumnType)
                            {
                            case ColumnType.SystemColumn:
                                addcolumn.m_ColumnWidth = Unit.Percentage(1);
                                break;

                            case ColumnType.Decimal:
                            case ColumnType.Number:
                            {
                                int columnwidth = column.Title.Length * 12;

                                if (columnwidth > 200)
                                {
                                    columnwidth = 200;
                                }

                                addcolumn.m_ColumnWidth = Unit.Pixel(columnwidth);
                            }
                            break;
                            }
                            //                                else
                            //                                    addcolumn.ColumnWidth = Unit.Pixel(100);
                        }
                        else
                        {
                            addcolumn.m_ColumnWidth = column.WidthColumnHeaderTitle;
                        }
                        grid[column.ColumnId].WidthColumnHeaderTitle = addcolumn.m_ColumnWidth;
                    }
                    addcolumn.RenderBeginTag(writer, column, null, "<th");
                    // writer.Write("<div class=\"wgheadercell\" id=\"{0}h{1}\">", grid.ID, column.ColumnId);

                    if (column.UseAllRows &&
                        (grid.SelectableRows || grid.RowHighLight != Color.Empty))
                    {
                        grid.RowHighLight   = Color.Empty;
                        grid.SelectableRows = false;
                    }

                    if (column.IsInDataSource && column.Sortable)
                    {
                        string[] arrayParams = new string[1];
                        if (grid.MasterTable.DataSource != null)
                        {
                            arrayParams[0] = column.ColumnId;
                        }
                        else /*if (column.ColumnType == ColumnType.Foreignkey || !string.IsNullOrEmpty(grid.Sql))*/
                        {
                            arrayParams[0] = Interface.BuildTableElement(true, column.m_Table.DataSourceId, column.ColumnId);
                        }

                        /*else
                         * {
                         *  Foreignkey fk = (Foreignkey) column;
                         *  arrayParams[0] =
                         *      Foreignkey.BuildDisplayTextSql(
                         *          string.Format(" [_pk{0}_{1}].", sortedColumns[ii], fk.DataSourceId),
                         *          fk.ValueColumn, string.Empty,
                         *          true, fk.Table);
                         *  if (fk.Table.DataSource != null)
                         *      arrayParams[0] = fk.ColumnId;
                         * }*/
                        string columnHeaderText = column.HeaderText;

                        if (string.IsNullOrEmpty(column.ToolTipGridHeaderText) == false)
                        {
                            columnHeaderText = Tooltip.Add(columnHeaderText, column.ToolTipGridHeaderText);
                        }



                        StringBuilder hyperlink;
                        if (!grid.AllowSort)
                        {
                            hyperlink = new StringBuilder(
                                String.Format("<span  class=\"{1}\">{0}</span>",
                                              columnHeaderText, null));
                        }
                        else
                        {
                            string sortimage = string.Empty;
                            // Up/down images
                            if (grid.DisplaySortIcons &&
                                grid.MasterTable.OrderBySortList[arrayParams[0]] != null)
                            {
                                /*StringBuilder img = new StringBuilder("sort-");
                                 * if (grid.MasterTable.OrderBySortList[arrayParams[0]].m_Desc)
                                 *  img.Append("down");
                                 * else
                                 *  img.Append("up");
                                 * if (grid.MasterTable.OrderBySortList[arrayParams[0]].m_DisplayIndex != 0)
                                 *  img.Append("2");
                                 * img.Append(".gif");
                                 *
                                 * string sort =
                                 *  string.Format("&nbsp;<img style=\" border:0px\" alt=\"{0}\" src=\"{1}{2}\" />",
                                 *                grid.GetSystemMessage("SortIcon"), grid.ImagePath, img);*/
                                if (grid.MasterTable.OrderBySortList[arrayParams[0]].m_Desc)
                                {
                                    sortimage = string.Format(
                                        @"<span title=""{0}"" style=""float:left""  class=""ui-icon ui-icon-triangle-1-s""/>",
                                        grid.GetSystemMessage("SortIcon"));
                                }
                                else
                                {
                                    sortimage = string.Format(
                                        @"<span title=""{0}"" style=""float:left"" class=""ui-icon ui-icon-triangle-1-n""/>",
                                        grid.GetSystemMessage("SortIcon"));
                                }
                            }
                            hyperlink = new StringBuilder("<table cellspacing=\"0\" cellpadding=\"0\"><tr><td>");
                            hyperlink.Append(new StringBuilder(
                                                 Buttons.Anchor(grid, columnHeaderText,
                                                                "ColumnHeaderClick", arrayParams, null,
                                                                null, null, null, false)));
                            hyperlink.Append("</td><td>");
                            hyperlink.Append(sortimage);
                            hyperlink.Append("</td></tr></table>");
                        }
                        if (grid.NonBreakingHeaders)
                        {
                            hyperlink.Insert(0, "<span class=\"wgnowrap\">");
                            hyperlink.Append("</span>");
                        }
                        writer.Write(hyperlink.ToString());
                    }
                    else
                    {
                        string css = string.Empty;
                        if (grid.NonBreakingHeaders)
                        {
                            css += " wgnowrap";
                        }
                        writer.Write("<span class=\"{0}\">{1}</span>", css, column.HeaderText);
                    }

                    addcolumn.RenderEndTag(writer, "</th>");
                }
                writer.Write("</tr>");
                // FINISH CREATE HEADING
            }
            if (grid.RecordsPerRow == 1)
            {
                writer.Write("</thead>");
            }

            bool tree = !string.IsNullOrEmpty(grid.TreeParentId);

            writer.Write(grid.BeforeRowsEvent());
            if (grid.Trace.IsTracing)
            {
                grid.Trace.Trace("Started Rendering Rows ({0})", grid.ID);
            }
            writer.Write("<tbody>");

            CreateRows(grid, tree, null, 0, writer, sortedColumns, 0);

            if (grid.RecordsPerRow == 1)
            {
                CreateTotalSummary(grid, writer, sortedColumns);
            }

            if (grid.Trace.IsTracing)
            {
                grid.Trace.Trace("Stopped Rendering Rows ({0}).", grid.ID);
            }
            writer.Write(grid.AfterRowsEvent());

            writer.Write("</tbody>");

            if (!string.IsNullOrEmpty(grid.GetToolbarHtml(ToolbarType.ToolbarGridBottom)))
            {
                writer.Write("<tfoot>");
                if (grid.IsUsingJQueryUICSSFramework)
                {
                    writer.Write("<tr class=\"ui-widget-header wgrow\"><td colspan=\"{0}\" class=\"wgtoolbargrid\">",
                                 sortedColumns.Length);
                }
                else
                {
                    writer.Write("<tr class=\"wgrow\"><td colspan=\"{0}\" class=\"wgtoolbargrid\">",
                                 sortedColumns.Length);
                }
                CreateGridToolbar(grid.GetToolbarHtml(ToolbarType.ToolbarGridBottom), writer, grid);
                writer.Write("</td></tr></tfoot>");
            }
            writer.Write("</table>");

            if (grid.Page != null)
            {
                if (grid.EnableCallBack)
                {
                    writer.Write("<input type=\"hidden\" id=\"{0}checkboxes\" name=\"{0}checkboxes\" value=\"{1}\" />",
                                 grid.ClientID, m_Checkboxlist.ToString());
                }
                else
                {
                    grid.Page.ClientScript.RegisterHiddenField(string.Format("{0}checkboxes", grid.ClientID),
                                                               m_Checkboxlist.ToString());
                }
            }
        }