public static void HandleEditableGridItemCreated(BasePage page, RadGrid Grid, CodeTorch.Core.Grid GridConfig, List <Section> Sections, string SectionZoneLayout, bool DisplayAddButton, object source, GridItemEventArgs e) { if (e.Item is GridCommandItem) { if (!DisplayAddButton) { GridFunctions.HideAddCommandItem(Grid); } } if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { Control c = page.FindControlRecursive(e.Item, GridEditFormItem.EditFormUserControlID); if (c != null) { GridDetail detail = ((GridDetail)c); detail.Sections = Sections; detail.SectionZoneLayout = SectionZoneLayout; if (e.Item.OwnerTableView.IsItemInserted) { detail.Mode = SectionMode.Insert; detail.Render(); detail.SetSaveButtonToInsertMode(); detail.SettingSectionTitle("Add"); } else { detail.Mode = SectionMode.Edit; detail.Render(); detail.SetSaveButtonToUpdateMode(); detail.SettingSectionTitle("Edit"); } } } }
public static void BuildEditableGrid(BasePage page, RadGrid Grid, CodeTorch.Core.Grid GridConfig, ScreenActionLink AddLink, string ResourceKeyPrefix) { if (GridConfig != null) { if (!String.IsNullOrEmpty(GridConfig.CssClass)) { Grid.CssClass = GridConfig.CssClass; } if (!String.IsNullOrEmpty(GridConfig.SkinID)) { Grid.SkinID = GridConfig.SkinID; } if (!String.IsNullOrEmpty(GridConfig.Skin)) { Grid.Skin = GridConfig.Skin; } Grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top; Grid.MasterTableView.CommandItemSettings.AddNewRecordText = AddLink.Text; Grid.MasterTableView.CommandItemSettings.ShowRefreshButton = GridConfig.ShowRefreshButton; SetupCsvExportSettings(Grid, GridConfig); Grid.MasterTableView.CommandItemSettings.ShowExportToExcelButton = GridConfig.ShowExportToExcelButton; Grid.MasterTableView.CommandItemSettings.ShowExportToPdfButton = GridConfig.ShowExportToPdfButton; Grid.MasterTableView.CommandItemSettings.ShowExportToWordButton = GridConfig.ShowExportToWordButton; Grid.ExportSettings.OpenInNewWindow = GridConfig.ExportOpenInNewWindow; Grid.ExportSettings.IgnorePaging = GridConfig.ExportIgnorePaging; Grid.ExportSettings.HideStructureColumns = GridConfig.ExportHideStructureColumns; if (!String.IsNullOrEmpty(GridConfig.ExportFileName)) { Grid.ExportSettings.FileName = GridConfig.ExportFileName; } else { if (!String.IsNullOrEmpty(GridConfig.Name)) { Grid.ExportSettings.FileName = GridConfig.Name; } } Grid.MasterTableView.EnableColumnsViewState = false; Grid.MasterTableView.EditMode = GridEditMode.EditForms; Grid.MasterTableView.EditFormSettings.EditFormType = GridEditFormType.WebUserControl; Grid.MasterTableView.EditFormSettings.UserControlName = "~/templates/sections/griddetail.ascx"; //SectionHeaderLabel.Text = GetGlobalResourceString(page, GridConfig, ResourceKeyPrefix, "Name", GridConfig.Name); //SectionHelpTextLabel.Text = GetGlobalResourceString(page, GridConfig, ResourceKeyPrefix, "HelpText", GridConfig.HelpText); Grid.AllowSorting = GridConfig.AllowSorting; Grid.AllowPaging = GridConfig.AllowPaging; if (!String.IsNullOrEmpty(GridConfig.DataKeyNames)) { Grid.MasterTableView.DataKeyNames = GridConfig.DataKeyNames.Split(','); } if (Grid.AllowPaging) { Grid.PageSize = GridConfig.PageSize; } SetupGridScrolling(Grid, GridConfig); foreach (CodeTorch.Core.GridColumn column in GridConfig.Columns) { bool isColumnVisible = true; if (column.VisiblePermission.CheckPermission) { isColumnVisible = Common.HasPermission(column.VisiblePermission.Name); } if (isColumnVisible) { GridFunctions.BuildGridColumn(page, Grid, GridConfig, column, ResourceKeyPrefix + ".Columns"); } } SetupGridGrouping(Grid, GridConfig); SetupGridClientSettings(Grid, GridConfig); } }