Hi, I'm currently implementing Copy to Excel functionality and it works great for all but Combo/MultiCombo columns.
I'm trying to implement it in a generic way so I don't want to cast the data source of the combo and find the value from there. Is there a simple way to reach the Displayed data?
Thanks!
I'm trying to implement it in a generic way so I don't want to cast the data source of the combo and find the value from there. Is there a simple way to reach the Displayed data?
Thanks!
private string ConvertDataToString(bool onlySelectedRows){ StringBuilder sbTextData = new StringBuilder(); // Copy columns header foreach (GridViewColumn col in this.radGridView.Columns) { sbTextData.Append(col.HeaderText.Replace("\n", " ") + "\t"); } sbTextData.Append("\n"); // Convert only selected rows if (onlySelectedRows) { foreach (GridViewRowInfo row in this.radGridView.SelectedRows) { int i = 0; while (i < row.Cells.Count) { if (i > 0) { sbTextData.Append("\t"); } if (row.Cells[i].ColumnInfo is GridViewComboBoxColumn) { // Obtain displayed data } else if (row.Cells[i].Value == null) { sbTextData.Append(string.Empty); } else { sbTextData.Append(row.Cells[i].Value.ToString()); } i++; } sbTextData.Append("\n"); } } else { foreach (GridViewRowInfo row in this.radGridView.Rows) { int i = 0; while (i < row.Cells.Count) { if (i > 0) { sbTextData.Append("\t"); } if (row.Cells[i].Value == null) { sbTextData.Append(string.Empty); } else { sbTextData.Append(row.Cells[i].Value.ToString()); } i++; } sbTextData.Append("\n"); } } return sbTextData.ToString();}