how to create CSV
hi
im using code error show in line (stringbuilder sb = new stringbuilder(); ) can u plz give me stringbuilder class
response.clear();
response.buffer =
true;
response.addheader(
"content-disposition",
"attachment;filename=gridviewexport.csv");
response.charset =
"";
response.contenttype =
"application/text";
dgporesult.allowpaging =
false;
dgporesult.databind();
stringbuilder sb =
new stringbuilder();
for (int k = 0; k < dgporesult.columns.count; k++)
{
//add separator
sb.append(dgporesult.columns[k].headertext +
',');
}
//append new line
sb.append(
"\r\n");
for (int = 0; < dgporesult.rows.count; i++)
{
for (int k = 0; k < dgporesult.columns.count; k++)
{
//add separator
sb.append(dgporesult.rows[i].cells[k].text +
',');
}
//append new line
sb.append(
"\r\n");
}
response.output.write(sb.tostring());
response.flush();
response.end();
onion recent refuge mac os x , hates mac app store. system: windows 7 x64
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment