Pessoal,
Estou precisando fazer uma função que export os dados para um CSV. Porém o container de dados não sei o tipo (DataTable, DataReader, List, outros).
Bem, pensei em carregar os dados em um DataGrid depois navegar pelo DataGrid para pegar os dados. Porém isto não é possivel porque o DataGrid ainda não foi reinderizado.
Alguem teria uma dica/sugestão ?
Agradeço,
private
string DadosCSV(){
DataGrid objGrid = newDataGrid();
objGrid.DataSource = ViewState[
"Table"];objGrid.DataBind();
string strText = string.Empty;for (int x = 0; x < objGrid.Columns.Count; x++)
" ", " ") + ";");strText = strText + (objGrid.Columns[x].HeaderText.ToString().Replace(
for (int x = 0; x < objGrid.Items.Count; x++)
{
for (int y = 0; y < objGrid.Columns.Count; y++)
strText = strText + (objGrid.Items[x].Cells.Text.ToString().Replace(" ", " ") + ";");
}
return strText;
}