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


C# Grid.GetSystemMessage方法代码示例

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


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

示例1: CreateUpdateRowsButton

        internal static string CreateUpdateRowsButton(Grid grid)
        {
            foreach (Column column in grid.MasterTable.Columns)
            {
                if (column.Visibility != Visibility.Grid)
                    continue;
                if (column.ColumnType != ColumnType.SystemColumn ||
                    ((SystemColumn) column).SystemColumnType != Enums.SystemColumn.UpdateRecordsLink) continue;
                string html = ((SystemColumn) column).Html;

                if (string.IsNullOrEmpty(html))
                    continue;
                return Buttons.TextButtonControl(grid, html, "UpdateRowsClick", new string[] {},
                                                 grid.GetSystemMessageClass("NewRecord", "wgnewrecord"));
            }

            GridPart customUpdateRecords = GridPart.GetControl(grid, Enums.GridPart.UpdateRecords);

            if (customUpdateRecords != null)
            {
                StringBuilder builder = new StringBuilder();
                StringWriter theStringWriter = new StringWriter(builder);
                System.Web.UI.HtmlTextWriter theHtmlWriter = new System.Web.UI.HtmlTextWriter(theStringWriter);
                string html = customUpdateRecords.Html ?? grid.GetSystemMessage("UpdateRows");
                theHtmlWriter.Write(Buttons.TextButtonControl(grid, html, "UpdateRowsClick", new string[] { },
                                          grid.GetSystemMessageClass("UpdateRows", "wgupdaterecords"),null,string.Format("{0}_wgupdaterecords", grid.ID))
                    );

                customUpdateRecords.m_InternalHtml = builder.ToString();
                return null;
            }
            return Buttons.TextButtonControl(grid, grid.GetSystemMessage("UpdateRows"), "UpdateRowsClick",
                                             new string[] {},
                                             grid.GetSystemMessageClass("UpdateRows", "wgupdaterecords"), null, string.Format("{0}_wgupdaterecords", grid.ID));
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:35,代码来源:RenderingMethods.cs

示例2: CreateNewPostButton

        internal static string CreateNewPostButton(Grid grid)
        {
            if (grid.AllowNew)
            {
                foreach (Column column in grid.MasterTable.Columns)
                    if (column.ColumnType == ColumnType.SystemColumn &&
                        ((SystemColumn) column).SystemColumnType == Enums.SystemColumn.NewRecordLink)
                    {
                        if (column.Visibility == Visibility.None)
                            return string.Empty;
                        if (((SystemColumn) column).Html != null)
                            return
                                Buttons.TextButtonControl(grid, ((SystemColumn) column).Html, "NewRecordClick",
                                                          new string[] {},
                                                          grid.GetSystemMessageClass("NewRecord", "wgnewrecord"));
                        break;
                    }

                GridPart customNewRecord = GridPart.GetControl(grid, Enums.GridPart.NewRecord);
                if (customNewRecord != null)
                {
                    StringBuilder builder = new StringBuilder();
                    StringWriter theStringWriter = new StringWriter(builder);
                    System.Web.UI.HtmlTextWriter theHtmlWriter = new System.Web.UI.HtmlTextWriter(theStringWriter);
                    string html = customNewRecord.Html ?? grid.GetSystemMessage("NewRecord");
                    theHtmlWriter.Write(Buttons.TextButtonControl(grid, html, "NewRecordClick", new string[] {},
                                                                  grid.GetSystemMessageClass("NewRecord", "wgnewrecord")));
                    customNewRecord.m_InternalHtml = builder.ToString();
                }
                else
                    return Buttons.TextButtonControl(grid, grid.GetSystemMessage("NewRecord"), "NewRecordClick",
                                                     new string[] {},
                                                     grid.GetSystemMessageClass("NewRecord", "wgnewrecord"));
            }
            return string.Empty;
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:36,代码来源:RenderingMethods.cs

示例3: CreateSearchField

        internal static string CreateSearchField(Grid grid)
        {
            StringBuilder javascript = new StringBuilder(string.Empty);

            StringBuilder onblur = new StringBuilder(" onblur=\"");
            if (grid.InputHighLight != Color.Empty)
            {
                javascript.AppendFormat(
                    " onfocus=\"this.accessKey = this.style.backgroundColor;this.style.backgroundColor='{0}';\"",
                    Grid.ColorToHtml(grid.InputHighLight));
                onblur.Append("this.style.backgroundColor=this.accessKey;");
            }
            if (grid.ColumnChangedColour != Color.Empty)
            {
                onblur.AppendFormat("isChanged(this,'{0}');", Grid.ColorToHtml(grid.ColumnChangedColour));
            }
            onblur.Append("\"");
            javascript.Append(onblur);

            string s =
                string.Format(
                    "<input {0}  type=\"text\" onkeypress=\"return submitenter(this,event)\" class=\"wgeditfield wgsearchfield\" name=\"{1}_gridsearch\" value=\"{2}\"/>&nbsp;",
                    javascript, grid.ClientID, grid.Search);

            GridPart customSearchField = GridPart.GetControl(grid, Enums.GridPart.SearchField);
            //			editorSystem.Web.HttpContext.Current.Server.ClientScript.RegisterClientScriptBlock(page.GetType(),"WGSearchBox", @"

            if (customSearchField != null)
            {
                StringBuilder builder = new StringBuilder();
                StringWriter theStringWriter = new StringWriter(builder);
                System.Web.UI.HtmlTextWriter theHtmlWriter = new System.Web.UI.HtmlTextWriter(theStringWriter);
                if (customSearchField.Html != null)
                {
                    Buttons.TextButtonControl(grid, customSearchField.Html, "SearchClick", new string[] {},
                                              grid.GetSystemMessageClass("Search", "wgsearch"));
                    customSearchField.m_InternalHtml = s + builder;
                }
                else
                {
                    theHtmlWriter.Write(Buttons.TextButtonControl(grid, grid.GetSystemMessage("Search"), "SearchClick", new string[] { },
                                              grid.GetSystemMessageClass("Search", "wgsearch")));
                    customSearchField.m_InternalHtml = s + builder;
                }
            }
            else
            {
                return
                    String.Format(
                        "<table cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"middle\"><td>{0}</td><td>{1}</td></tr></table>",
                        s,

                         Buttons.TextButtonControl(grid, grid.GetSystemMessage("Search"), "SearchClick", new string[] {},
                                                   grid.GetSystemMessageClass("Search", "wgsearch")));
            }
            return string.Empty;
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:57,代码来源:RenderingMethods.cs

示例4: CreateTotalSummary

        private static void CreateTotalSummary(Grid grid, WebGridHtmlWriter writer, int[] sortedColumnID)
        {
            if (grid.MasterTable.Rows.Count == 0)
                return;
            int firstSumColumn = GetFirstSummary(sortedColumnID, grid);

            if (firstSumColumn == sortedColumnID.Length)
                return;

            string columnId = null;
            foreach (int ii in sortedColumnID)
            {
                Column column = grid.MasterTable.Columns[ii];
                if (column.ColumnType == ColumnType.SystemColumn)
                    continue;
                columnId = column.ColumnId;
                break;
            }
            if (string.IsNullOrEmpty(columnId))
                columnId = grid[firstSumColumn].ColumnId;
            grid.m_RowsAdded++;
            if(!grid.IsUsingJQueryUICSSFramework)
                writer.Write(
                "<tr id=\"{0}r{1}\" class=\"wgrow\"><td colspan=\"{2}\" id=\"{0}{4}r{1}\" class=\"wgtotal\">{3}</td>",
                grid.ID, grid.m_RowsAdded, firstSumColumn, grid.GetSystemMessage("TotalSummary"), columnId);
            else
            {
                writer.Write(
                    "<tr id=\"{0}r{1}\" class=\"ui-state-highlight wgrow\"><td colspan=\"{2}\" id=\"{0}{4}r{1}\" class=\"wgtotal\">{3}</td>",
                    grid.ID, grid.m_RowsAdded, firstSumColumn, grid.GetSystemMessage("TotalSummary"), columnId);

            }
            grid.MasterTable[0].m_RowIndex = grid.m_RowsAdded;
            for (int ii = firstSumColumn; ii < sortedColumnID.Length; ii++)
            {
                grid.MasterTable.Columns[sortedColumnID[ii]].Grid = grid;

                RowCell cell = grid.MasterTable[0][sortedColumnID[ii]];
                Column column = grid.MasterTable.Columns[sortedColumnID[ii]];
                if (column.ColumnType == ColumnType.Decimal && ((WebGrid.Decimal)column).DisplayTotalSummary)
                {
                    column.CssClass = "wgtotalcell";
                    column.AllowEdit = false;
                    if (grid.Trace.IsTracing)
                        grid.Trace.Trace("TotalSummary for column '{0}' is {1}", column.ColumnId,
                                        ((WebGrid.Decimal)column).TotalSum);
                    cell.Value = ((WebGrid.Decimal)column).TotalSum;
                    ((WebGrid.Decimal)column).Sum = null;
                    column.Visibility = Visibility.Grid;
                    column.Render(writer, cell);
                    column.CssClass = null;
                }
                else
                {
                    writer.Write("<td id=\"{0}{1}r{2}\" class=\"wgtotal\">&nbsp;</td>", grid.ID, column.ColumnId,
                                 grid.MasterTable[0].m_RowIndex);
                }
            }

            writer.Write("</tr>");
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:61,代码来源:Rendering.cs

示例5: RenderDetail


//.........这里部分代码省略.........
                }
                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;

                        if (columnwidth > 140)
                            columnwidth = 140;
                        columnName.m_ColumnWidth = Unit.Pixel(columnwidth);
                    }
                    columnName.RenderBeginTag(writer, column, null,"<td");

                    if (string.IsNullOrEmpty(column.ToolTipEditTitle))
                        writer.Write(column.Title);
                    else
                        writer.Write(Tooltip.Add(column.Title, column.ToolTipEditTitle));

                    antcols++;

                    if (grid.BasicDetailLayout == false)
                        columnName.RenderEndTag(writer,"</td>");

                    if (grid.DisplayRequiredColumn)
                    {
                        antcols++;
                        ColumnHeader requiredColumn = new ColumnHeader
                                                {
                                                    m_Class =
                                                        string.Format("wgrequiredcolumn {0}", column.CssClassTitle),
                                                    m_ColumnWidth = Unit.Pixel(1),
                                                    m_VAlign =
                                                        (column.HeightEditableColumn.IsEmpty
                                                             ? column.EditVAlign
                                                             : VerticalPosition.top)
                                                };

                        requiredColumn.RenderBeginTag(writer, column, null,"<td");

                        if (column.Required && column.AllowEdit)
                            writer.Write(@"<span title=""{0}"" class=""ui-icon ui-icon-info""/>",
                                         grid.GetSystemMessage("Required"));
                        else
                            writer.Write("&nbsp;");

                        requiredColumn.RenderEndTag(writer, "</td>");
                    }
                }
                antcols++;
                if ((i == sortedColumns.Length - 1 || (i + 1 < sortedColumns.Length && grid[sortedColumns[i + 1]].NewRowInDetail)) && antcols < columnWidth)
                    grid.Rows[0][column.ColumnId].InternalCellSpan += columnWidth - antcols;

                //   column.Row = grid.MasterTable.Rows[0];
                column.Render(writer, grid.Rows[0][column.ColumnId]);

                if (i == sortedColumns.Length - 1 ||
                    (i + 1 < sortedColumns.Length &&
                     grid[sortedColumns[i + 1]].NewRowInDetail))
                {
                    writer.Write("</tr>");
                }

                if (column.UseAllRows)
                    if (i + 1 < sortedColumns.Length)
                        writer.Write("</table></td><td><table class=\"wgrowspan\">");
                    else
                        writer.Write("</table>");
                else if (allRowsColumns > 0 && i + 1 == sortedColumns.Length)
                    writer.Write("</table>");
            }
            if (allRowsColumns > 0)
                writer.Write("</td></tr></table></td></tr>");

            // Create tail
            if (string.IsNullOrEmpty(grid.GetToolbarHtml(ToolbarType.ToolbarDetailBottom)) == 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.ToolbarDetailBottom), writer, grid, editablecolumns);
                writer.Write("</td></tr>");
            }

            writer.Write("</table>");
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:101,代码来源:Rendering.cs

示例6: CreateGridToolbar

        private static void CreateGridToolbar(string toolbar, WebGridHtmlWriter writer, Grid grid)
        {
            if (toolbar.IndexOf("[NEWRECORD]", StringComparison.OrdinalIgnoreCase) > -1)
            {
                if (grid.AllowNew)
                {
                    bool allownew = false;
                    for (int i = 0; i < grid.MasterTable.Columns.Count; i++)
                        if (grid.MasterTable.Columns[i].AllowEdit &&
                            grid.MasterTable.Columns[i].IsInDataSource &&
                            (grid.MasterTable.Columns[i].Visibility == Visibility.Both ||
                             grid.MasterTable.Columns[i].Visibility == Visibility.Detail))
                        {
                            allownew = true;
                            break;
                        }
                    toolbar = allownew
                                  ? toolbar.Replace("[NEWRECORD]", CreateNewPostButton(grid))
                                  : toolbar.Replace("[NEWRECORD]", string.Empty);
                }
                else
                    toolbar = toolbar.Replace("[NEWRECORD]", string.Empty);
            }
            if (toolbar.IndexOf("[CLOSEWINDOW]", StringComparison.OrdinalIgnoreCase) > -1)
            {
                if (grid.m_MasterWebGrid != null && grid.m_MasterWebGrid.DisplaySlaveGridMenu
                    && grid.m_IsGridInsideGrid == false)
                {
                    toolbar =
                        toolbar.Replace("[CLOSEWINDOW]",
                                        (
                                            Buttons.TextButtonControl(grid, grid.GetSystemMessage("CloseWindow"),
                                                                      "RecordCancelClick",
                                                                      new[]
                                                                          {
                                                                              string.Format("{0}!{1}", grid.InternalId,
                                                                                            grid.
                                                                                                m_IsOneToOneRelationGrid)
                                                                          }
                                                                      ,
                                                                      grid.GetSystemMessageClass("CloseWindow",
                                                                                                 "wgclosewindow"))));
                }
                else
                    toolbar = toolbar.Replace("[CLOSEWINDOW]", string.Empty);
            }

            if (toolbar.IndexOf("[UPDATEROWS]", StringComparison.OrdinalIgnoreCase) > -1)
            {
                toolbar = grid.AllowUpdateRows
                              ? toolbar.Replace("[UPDATEROWS]", CreateUpdateRowsButton(grid))
                              : toolbar.Replace("[UPDATEROWS]", string.Empty);
            }
            if (toolbar.IndexOf("[SEARCHFIELD]", StringComparison.OrdinalIgnoreCase) > -1)
            {
                toolbar = grid.DisplaySearchBox != Position.Hide
                              ? toolbar.Replace("[SEARCHFIELD]", CreateSearchField(grid))
                              : toolbar.Replace("[SEARCHFIELD]", string.Empty);
            }
            if (toolbar.IndexOf("[PAGER]", StringComparison.OrdinalIgnoreCase) > -1)
            {
                if (grid.PagerSettings.PagerType != PagerType.None && grid.RecordCount > grid.PageSize)
                {
                    string pager = CreatePager(grid);
                    if (string.IsNullOrEmpty(pager) == false)
                        pager =
                            string.Format(
                                "<table class=\"wgpager\"><tr><td>{0}</td><td>{1}</td></tr></table>",
                                grid.PagerPrefix, pager);
                    toolbar = toolbar.Replace("[PAGER]", pager);
                }
                else
                    toolbar = toolbar.Replace("[PAGER]", string.Empty);
            }
            if (toolbar.IndexOf("[PAGERSTATUS]", StringComparison.OrdinalIgnoreCase) > -1)
                toolbar = PagerType.None != grid.PagerSettings.PagerType && grid.RecordCount > grid.PageSize
                              ? toolbar.Replace("[PAGERSTATUS]", grid.PagerSettings.GetPagerStatus)
                              : toolbar.Replace("[PAGERSTATUS]", string.Empty);

            if (string.IsNullOrEmpty(toolbar) == false)
                writer.Write(toolbar);
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:82,代码来源:Rendering.cs

示例7: CreateDetailToolbar

        private static void CreateDetailToolbar(string toolbar, WebGridHtmlWriter writer, Grid grid, bool editablecolumns)
        {
            if (toolbar.IndexOf("[UPDATE]", StringComparison.OrdinalIgnoreCase) > -1)
            {
                if (editablecolumns)
                {
                    string updatemessage = grid.StayInDetail || grid.m_IsGridInsideGrid ? "Update" : "UpdateClose";

                    string status = string.Empty;
                    if (grid.m_IsOneToOneRelationGrid && grid.m_IsOneToOneRelationNewRecord)
                        status = "!new";
                    if (grid.m_IsOneToOneRelationGrid && grid.m_IsOneToOneRelationNewRecord == false)
                        status = "!update";
                    toolbar =
                        toolbar.Replace("[UPDATE]",
                                        (
                                         Buttons.TextButtonControl(grid, grid.GetSystemMessage(updatemessage),
                                                                   "RecordUpdateClick",
                                                                   new[]
                                                                       {
                                                                           string.Format("{0}!{1}{2}", grid.InternalId,
                                                                                         grid.m_IsCopyClick, status)
                                                                       },
                                                                   grid.GetSystemMessageClass(updatemessage,
                                                                                              "wgupdaterecord"), null, grid.ID + "_wgupdaterecord")));
                }
                else
                    toolbar = toolbar.Replace("[UPDATE]", string.Empty);
            }

            if (toolbar.IndexOf("[CLOSEWINDOW]", StringComparison.OrdinalIgnoreCase) > -1)
            {
                if ((grid.MasterWebGrid != null && !grid.m_IsGridInsideGrid) ||
                    (grid.ActiveMenuSlaveGrid == null || (grid.m_HasGridInsideGrid && grid.ActiveMenuSlaveGrid == null)) &&
                    (grid.AllowCancel) || (grid.m_IsGridInsideGrid && grid.AllowCancel))
                {
                    if ((grid.MasterWebGrid != null && grid.m_IsGridInsideGrid == false) && grid.AllowCancel == false)
                        grid.m_IsOneToOneRelationGrid = true;
                    toolbar = toolbar.Replace("[CLOSEWINDOW]",
                                              (
                                               Buttons.TextButtonControl(grid, grid.GetSystemMessage("CloseWindow"),
                                                                         "RecordCancelClick",
                                                                         new[]
                                                                             {
                                                                                 string.Format("{0}!{1}", grid.InternalId,
                                                                                               grid.
                                                                                                   m_IsOneToOneRelationGrid)
                                                                             }
                                                                         ,
                                                                         grid.GetSystemMessageClass("CloseWindow",
                                                                                                    "wgclosewindow"))));
                }
                else
                {
                    toolbar = toolbar.Replace("[CLOSEWINDOW]", string.Empty);
                }
            }
            if (string.IsNullOrEmpty(toolbar) == false)
                writer.Write(toolbar);
        }
开发者ID:webgrid,项目名称:WebGrid,代码行数:60,代码来源:Rendering.cs

示例8: RenderGrid


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


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