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


C# Grid.GetSystemMessageClass方法代码示例

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


在下文中一共展示了Grid.GetSystemMessageClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: 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


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