Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
Copy all values in a column.
posted

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