I'm exporting my radgrid to Excel, that part is working great. What I'm having trouble with is one of the columns in the gridview is a listbox, so in my export, I want to export the list. I do have that working correctly, I'm getting all items in the list. Where I'm stuck is I want each item in the list to be on a different line in the Excel cell, so when it exports and I open Excel I want to see
Item A
Item B
Item C
what I currently get is Item A Item B Item C
Below is my code, is there something obvious I'm missing to accomplish this?
Item A
Item B
Item C
what I currently get is Item A Item B Item C
Below is my code, is there something obvious I'm missing to accomplish this?
if
(e.Element == ExportElement.Cell)
{
if (e.Value is SurveyDetail)
{
SurveyDetail surveyDetail = (SurveyDetail)e.Value;
if (e.Context is Telerik.Windows.Controls.GridViewDataColumn)
{
Telerik.Windows.Controls.
GridViewDataColumn dc = (Telerik.Windows.Controls.GridViewDataColumn)e.Context;
if (dc.Name == "dcCPUJobCode")
{
StringBuilder sb = new StringBuilder();
foreach (CPUJobCode cpuJobCode in surveyDetail.SurveyJobCode.CPUJobCodes)
{
sb.Append(
string.Format("{0} {1} \n", cpuJobCode.JobCode, cpuJobCode.JobTitle));
}
e.Value = sb.ToString();
}
}
}
}