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}\"/> ", 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); }
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); }
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))); }
internal static string CreatePager(Grid grid) { Pager pager = grid.PagerSettings; if (pager.PagerType == PagerType.None) { return(string.Empty); } pager.ImagePath = grid.ImagePath; pager.m_PagerGrid = grid; GridPart customPager = GridPart.GetControl(grid, Enums.GridPart.Pager); if (customPager != null) { customPager.m_InternalHtml = pager.GetPager; return(null); } return(pager.GetPager); }