Hi,
I am have a column that is bound to a string in the form comma separated list.
I want to display the list items on separate lines in the cell so I use the following
This works as expected. But I also want to use the ExportToCSV() feature using a linkbutton to trigger the export. I don't want <br/>s OR commas to appear in my exported CSV file so I attempt to change the data again prior to calling export as follows...
This does the expected change, but unfortunately the data gets bound again before it is actually exported so I get the initial comma separated data which in turn gets changed to include the <br/>s. Therefore I still get the <br/>s in my CSV file.
Is there any way to stop the grid from rebinding when the export function is called? Or can you suggest some other way of achieving the desired effect?
Cheers
I am have a column that is bound to a string in the form comma separated list.
I want to display the list items on separate lines in the cell so I use the following
protected void grvReport_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
GridDataItem item = ((GridDataItem)e.Item); |
item["coltrainerList"].Text = item["coltrainerList"].Text.Replace(",", "<br/>"); |
} |
// More unrelated stuff |
} |
This works as expected. But I also want to use the ExportToCSV() feature using a linkbutton to trigger the export. I don't want <br/>s OR commas to appear in my exported CSV file so I attempt to change the data again prior to calling export as follows...
foreach (GridDataItem item in grvReport.MasterTableView.Items) |
{ |
item["coltrainerList"]. Text = item["coltrainerList"].Text.Replace("<br/>", " - "); |
} |
grvReport.MasterTableView.ExportToCSV(); |
This does the expected change, but unfortunately the data gets bound again before it is actually exported so I get the initial comma separated data which in turn gets changed to include the <br/>s. Therefore I still get the <br/>s in my CSV file.
Is there any way to stop the grid from rebinding when the export function is called? Or can you suggest some other way of achieving the desired effect?
Cheers