private void ApplyStyleSheetsForExport(GridTableView gridTableView) { if (null != gridTableView.GetItems(GridItemType.Header) && gridTableView.GetItems(GridItemType.Header).Count() > 0) { GridItem headerItem = gridTableView.GetItems(GridItemType.Header)[0]; headerItem.Style["font-size"] = "8pt"; headerItem.Style["color"] = "black"; headerItem.Style["vertical-align"] = "middle"; headerItem.Style["width"] = "80px"; foreach (TableCell tableCell in headerItem.Cells) { tableCell.Wrap = true; tableCell.Style["text-align"] = "center"; tableCell.Style["font-weight"] = "bold"; tableCell.Style["font-size"] = "12pt"; tableCell.Style["width"] = "75px"; } GridItem[] items = gridTableView.GetItems(GridItemType.Item); GridItem[] alternatingItems = gridTableView.GetItems(GridItemType.AlternatingItem); ApplyGridItemStyle(items); ApplyGridItemStyle(alternatingItems); } }
private void ApplyStyleSheetsForExport(GridTableView gridTableView) { if (null != gridTableView.GetItems(GridItemType.Header) && gridTableView.GetItems(GridItemType.Header).Count() > 0) { gridTableView.Columns.FindByUniqueName("SelectionChecBox").Visible = false; gridTableView.Columns.FindByUniqueName("FollowUp").Visible = false; GridItem headerItem = gridTableView.GetItems(GridItemType.Header)[0]; headerItem.Style["font-size"] = "8pt"; headerItem.Style["color"] = "black"; headerItem.Style["height"] = "15px"; headerItem.Style["font-weight"] = "bold"; headerItem.Style["vertical-align"] = "middle"; headerItem.Style["width"] = "10px"; foreach (TableCell tableCell in headerItem.Cells) { tableCell.Wrap = true; tableCell.Style["text-align"] = "center"; tableCell.Style["font-weight"] = "bold"; tableCell.Style["font-size"] = "5pt"; } GridItem[] items = gridTableView.GetItems(GridItemType.Item); GridItem[] alternatingItems = gridTableView.GetItems(GridItemType.AlternatingItem); ApplyGridItemStyle(items); ApplyGridItemStyle(alternatingItems); } }
// function for export setting protected void GridTableHierarchySetEditability(GridTableView view, bool editAllowed) { foreach (GridFilteringItem item in view.GetItems(GridItemType.FilteringItem)) { item.Visible = false; } foreach (GridHeaderItem item in view.GetItems(GridItemType.Header)) { if (item.Cells[0].Text == " ") { item.Cells[0].Visible = false; } } //If editing is not allowed, remove any edit or command-button columns. if (editAllowed) { //Remove editing columns in the current view foreach (GridColumn column in view.Columns) { if (column.UniqueName == "ExpandColumn") { column.Display = false; column.Visible = false; } if (column.UniqueName == "DeletePaycode" || column.UniqueName == "EditPaycod") { column.Display = false; column.Visible = false; } if (column.UniqueName == "EditCitizen" || column.UniqueName == "DeleteCitizen") { column.Display = false; column.Visible = false; } if (column.UniqueName == "EditExpat" || column.UniqueName == "DeleteExpat") { column.Display = false; column.Visible = false; } } } if (view.HasDetailTables) { foreach (GridDataItem item in view.Items) { if (item.HasChildItems) { foreach (GridTableView innerView in item.ChildItem.NestedTableViews) { GridTableHierarchySetEditability(innerView, true); } } } } }
public void HideExpandColumnRecursive(GridTableView tableView) { GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); foreach (GridNestedViewItem nestedViewItem in nestedViewItems) { foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) { nestedView.Style["border"] = "0"; Button MyExpandCollapseButton = (Button)nestedView.ParentItem.FindControl("MyExpandCollapseButton"); if (nestedView.Items.Count == 0) { if (MyExpandCollapseButton != null) { MyExpandCollapseButton.Style["visibility"] = "hidden"; } nestedViewItem.Visible = false; } else { if (MyExpandCollapseButton != null) { MyExpandCollapseButton.Style.Remove("visibility"); } } if (nestedView.HasDetailTables) { HideExpandColumnRecursive(nestedView); } } } }
/// <summary> /// Hides the expand column recursive. /// </summary> /// <param name="tableView">The table view.</param> private void HideExpandColumnRecursive(GridTableView tableView) { GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); foreach (GridNestedViewItem nestedViewItem in nestedViewItems) { foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) { nestedView.Style["border"] = "0"; var myExpandCollapseButton = (Button)nestedView.ParentItem.FindControl("MyExpandCollapseButton"); if (nestedView.Items.Count == 0) { if (myExpandCollapseButton != null) { myExpandCollapseButton.Style["visibility"] = "hidden"; } nestedViewItem.Visible = false; } else { if (myExpandCollapseButton != null) { myExpandCollapseButton.Style.Remove("visibility"); } } if (nestedView.HasDetailTables) { this.HideExpandColumnRecursive(nestedView); } } } }
public void HideExpandColumnRecursive(GridTableView tableView) { GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); foreach (GridNestedViewItem nestedViewItem in nestedViewItems) { foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) { nestedView.ParentItem.Expanded = true; HideExpandColumnRecursive(nestedView); } } }
public void HideExpandColumnRecursive(GridTableView tableView) { thisUserPermissions.AddRange(KVSCommon.Database.User.GetAllPermissionsByID((Int32.Parse(Session["CurrentUserId"].ToString())))); GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); foreach (GridNestedViewItem nestedViewItem in nestedViewItems) { foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) { nestedView.ParentItem.Expanded = true; HideExpandColumnRecursive(nestedView); } } }
// export formating functions void HideCommandColumns(GridTableView gridTableView) { foreach (GridNestedViewItem nestedViewItem in gridTableView.GetItems(GridItemType.NestedView)) { if (nestedViewItem.NestedTableViews.Length > 0) { foreach (GridColumn column in gridTableView.Columns) { if (column.UniqueName == "EditHolidays" || column.UniqueName == "DeleteHolidays") { column.Display = false; column.Visible = false; } } HideCommandColumns(nestedViewItem.NestedTableViews[0]); } } }
private void toggleExpansionRecursive(GridTableView parentView, bool expandValue, bool reload = false) { //bool showEditFields = ShowEditFields(); GridItem[] childViewItems = parentView.GetItems(GridItemType.NestedView); foreach (GridNestedViewItem childView in childViewItems) { foreach (GridTableView nestedView in childView.NestedTableViews) { // nestedView.ParentItem.ItemIndexHierarchical GridDataItem item = nestedView.ParentItem as GridDataItem; string keyName = item.GetDataKeyValue("TagName").ToString(); if (reload || !Page.IsPostBack) { // on new load -- store in expandedStates this.ExpandedStates[keyName] = expandValue; } else { // after initial load -- storage in expandedStates is handled by ItemCommand // set expandValue from expandedStates expandValue = this.ExpandedStates[keyName] != null && (bool)this.ExpandedStates[keyName]; } // GridColumn dragcolumn = nestedView.Columns.FindByUniqueName("DragResponse") ; //if ((base.ShowEditFields(enumDocumentType.JQ)) && (base.HasHRGroupPermission)) //{ // if (dragcolumn!=null) // {dragcolumn.Visible =true;} //} //else //{ // if (dragcolumn != null) // { dragcolumn.Visible = false; } //} nestedView.ParentItem.Expanded = expandValue; toggleExpansionRecursive(nestedView, expandValue); } } }
public void HideExpandColumnRecursive(GridTableView tableView) { GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); foreach (GridNestedViewItem nestedViewItem in nestedViewItems) { foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) { if (nestedView.Items.Count == 0) { TableCell cell = nestedView.ParentItem["ExpandColumn"]; cell.Controls[0].Visible = false; nestedViewItem.Visible = false; } if (nestedView.HasDetailTables) { HideExpandColumnRecursive(nestedView); } } } }
public void HideExpandColumnRecursive(GridTableView tableView) { GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); foreach (GridNestedViewItem nestedViewItem in nestedViewItems) { foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) { if (nestedView.Items.Count == 0) { TableCell cell = nestedView.ParentItem["ExpandColumn"]; cell.Controls[0].Visible = false; nestedViewItem.Visible = false; } if (nestedView.HasDetailTables) { HideExpandColumnRecursive(nestedView); } } } }