当前位置: 首页>>代码示例>>C#>>正文


C# Grid.GetToolbarHtml方法代码示例

本文整理汇总了C#中Grid.GetToolbarHtml方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.GetToolbarHtml方法的具体用法?C# Grid.GetToolbarHtml怎么用?C# Grid.GetToolbarHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Grid的用法示例。


在下文中一共展示了Grid.GetToolbarHtml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderDetail

        internal static void RenderDetail(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( //ui-helper-reset
                    "<table width=\"{0}\" class=\"ui-widget-content  wgmaindetail\" cellspacing=\"0\" cellpadding=\"0\">", width);
            else
                writer.Write("<table width=\"{0}\" class=\"wgmaindetail\" cellspacing=\"0\" cellpadding=\"0\">", width);

            int[] sortedColumns = grid.VisibleSortedColumns;

            int columnWidth = -1;
            int allRowsColumns = 0;
            int ant = 0;

            bool firstvisiblecolumn = true;

            bool editablecolumns = grid.m_Forceeditablecolumns;

            for (int i = 0; i < sortedColumns.Length; i++)
            {
                ant += 2;
                // if( Grid.BasicDetailLayout )
                //	 ant--;
                if (grid.DisplayRequiredColumn)
                    ant++;

                if (ant > columnWidth)
                    columnWidth = ant;

                Column c = grid.MasterTable.Columns[sortedColumns[i]];
                if (c.UseAllRows)
                    allRowsColumns++;
                if (c.IsVisible == false)
                    continue;
                if (editablecolumns == false && c.AllowEdit)
                    editablecolumns = true;
                if (firstvisiblecolumn)
                {
                    firstvisiblecolumn = false;
                    continue;
                }
                if (c.NewRowInDetail)
                    ant = 0;
            }
            // Create head
            CreateTitle(grid, DisplayView.Detail, writer, sortedColumns, columnWidth,"td");

            if ((grid.CollapseIfSlaveGrid && grid.ActiveMenuSlaveGrid != null) || grid.CollapsedGrid)
            {
                writer.Write("</table>");
                return;
            }
            // Create toolbar
            if (string.IsNullOrEmpty(grid.GetToolbarHtml(ToolbarType.ToolbarDetailTop)) == false)
            {
                if( grid.IsUsingJQueryUICSSFramework)
                writer.Write(
                    "<tr class=\"ui-widget-header wgrow\"><td class=\"wgtoolbardetail\" colspan=\"{0}\">",
                    columnWidth);
                else
                    writer.Write(
                          "<tr class=\"wgrow\"><td class=\"wgtoolbardetail\" colspan=\"{0}\">",
                          columnWidth);
                CreateDetailToolbar(grid.GetToolbarHtml(ToolbarType.ToolbarDetailTop), writer, grid, editablecolumns);
                writer.Write("</td></tr>");
            }
            int antcols = 0;
            if (allRowsColumns > 0)
                writer.Write(
                    "<tr><td colspan=\"{0}\"><table class=\"wgrowspan\"><tr valign=\"top\"><td><table class=\"wgrowspan\">",
                    columnWidth);
            grid.MasterTable.Rows[0].RowIndex = -1;
            for (int i = 0; i < sortedColumns.Length; i++)
            {
                Column column = grid.MasterTable.Rows[0] != null ? grid.MasterTable.Columns[sortedColumns[i]] : grid.MasterTable.Columns[sortedColumns[i]];
                if (column.UseAllRows && i > 0)
                    writer.Write("</table></td><td><table class=\"wgrowspan\">");
                if (i == 0 || (i < sortedColumns.Length && column.NewRowInDetail))
                {
                    antcols = 0;
                    writer.Write("<tr class=\"wgrow\">");
                }
                if (!column.HideDetailTitle)
                {
                    ColumnHeader columnName = new ColumnHeader
                                        {
                                            m_VAlign = column.EditVAlign,
                                            m_Align = column.EditAlignTitle,
                                            m_ColumnWidth = column.WidthColumnTitle,
                                            m_Class = string.Format("{0} wgdetailheader", column.CssClassTitle),
                                            m_GridRowCount = (-1),
                                            m_GridId = grid.ID
                                        };
                    if (columnName.m_ColumnWidth == Unit.Empty)
                    {
                        int columnwidth = column.Title.Length * 12;

//.........这里部分代码省略.........
开发者ID:webgrid,项目名称:WebGrid,代码行数:101,代码来源:Rendering.cs

示例2: RenderGrid

        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;
                            }
//.........这里部分代码省略.........
开发者ID:webgrid,项目名称:WebGrid,代码行数:101,代码来源:Rendering.cs


注:本文中的Grid.GetToolbarHtml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。