TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Renjith Kumaran
NA
18
3.5k
CSV not downloading
Nov 1 2015 7:37 AM
I want to download the csv and load a new page in a asp.net application. My code is like this. I am not getting any error. The page loads properly, but the csv is downloading.. Kindly help me to resolve..
Response.Clear();
Response.ClearContent();
Response.ContentType = "application/text";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
Response.Charset = "";
string sep = "";
for (int i = 0; i <= dtsorted.Columns.Count - 1; i++)
{
Response.Write(sep + dtsorted.Columns[i].ColumnName + ',');
}
Response.Write("\r\n");
for (int i = 0; i < dtsorted.Rows.Count; i++)
{
sep = "";
for (int j = 0; j <= dtsorted.Columns.Count - 1; j++)
{
Response.Write(sep + dtsorted.Rows[i].ItemArray[j].ToString() + ',');
}
Response.Write("\r\n");
}
Response.SuppressContent = true;
Response.Redirect("VerifyLPODetails.aspx", false);
if (!Response.IsRequestBeingRedirected)
{
Response.Redirect("VerifyLPODetails.aspx", false);
}
}
}
Reply
Answers (
1
)
Checkbox and button inside gridview
Show date in datagridview column in c#