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
Hari B
NA
139
67.8k
multiple Excel files download
Sep 3 2015 4:08 AM
Hello All
Here I need to download multiple Excel sheets i use for loop. after one iterate loop I got am Exception like below
Server cannot append header after HTTP headers have been sent.
try
{
for(some condition)
{
//some code grid view//
Response.ClearContent();
Response.Buffer = true;
long lnUserID = clsLists.getCurrentUserId();
Response.AddHeader("content-disposition", "attachment; filename=Release-" + ReleaseEMCTSDB.users.SingleOrDefault(u => u.UserId ==
l
nUserID).UserName + "-" + DateTime.Now.ToString() + ".xls");
Response.AppendHeader("Name", "Value");
Response.ContentType = "application/ms-excel";
Response.Charset = "";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
string readergridview = sw.ToString();
gv.RenderControl(htw);
Response.Output.Write(sw.ToString());
Resp onse.Flush();
Response.End();
}
}
try
{
Exception
}
Please help me it is possible to iterate loop
Reply
Answers (
2
)
Memory
Input string was not in correct format