I am trying to implement "Copy selected column" using context menu. Following code works fine in a plain grid but when a band is introduced it fails. Is there any other way I can implement this functionality?
public static string GetDataFromEntireColumn(UltraGridCell currentCell, UltraGrid grid, bool includeHeader) { StringBuilder columnData = new StringBuilder(); if (currentCell != null) { foreach (UltraGridRow row in grid.Rows) { columnData.Append( row.Cells[currentCell.Column.Key].Text + Environment.NewLine); } if (includeHeader) { columnData.Insert(0,currentCell.Column.Header.Caption + Environment.NewLine); } } return columnData.ToString(); }
Thanks in advance
I Simplify your code
public string LeeCol(UltraGridBand banda, UltraGridColumn columna, bool titulo) {
StringBuilder columnData = new StringBuilder();IEnumerable enumerator = ultraGrid1.Rows.GetRowEnumerator(GridRowType.DataRow, banda, null); foreach (UltraGridRow row in enumerator) {
columnData.Append(row.Cells[columna.Key].Text + Environment.NewLine);
} if (titulo) {
columnData.Insert(0, columna.Header.Caption + Environment.NewLine);
} return columnData.ToString();
}
That's exactly what I want to know. How to find correct ChildBands collection in which the CurrentCell exists?
Thanks