Click here to Skip to main content
15,884,472 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Bind ASP.NET to a property of a class Pin
ezazazel26-Feb-10 0:14
ezazazel26-Feb-10 0:14 
QuestionASP.NET TOOLS Pin
ravanth25-Feb-10 21:53
ravanth25-Feb-10 21:53 
AnswerRe: ASP.NET TOOLS Pin
nainakarri25-Feb-10 22:14
nainakarri25-Feb-10 22:14 
GeneralRe: ASP.NET TOOLS Pin
ravanth26-Feb-10 1:20
ravanth26-Feb-10 1:20 
QuestionDownload link of the generated file changed when I moved the code to a new pop-up page [modified] Pin
Rafferty Uy25-Feb-10 16:01
Rafferty Uy25-Feb-10 16:01 
AnswerRe: Download link of the generated file changed when I moved the code to a new pop-up page Pin
Pranay Rana25-Feb-10 20:06
professionalPranay Rana25-Feb-10 20:06 
GeneralRe: Download link of the generated file changed when I moved the code to a new pop-up page Pin
Rafferty Uy25-Feb-10 20:14
Rafferty Uy25-Feb-10 20:14 
AnswerRe: Download link of the generated file changed when I moved the code to a new pop-up page Pin
Rafferty Uy25-Feb-10 22:11
Rafferty Uy25-Feb-10 22:11 
I finally found the solution!
I also had to clear the headers of the response, apparently, Response.Clear() only clears the content.
Maybe the header was somehow populated incorrectly by the new pop-up page.

So the fixed method is:
public static void Export(Page webPage)
{
    webPage.Response.ClearHeaders(); //added
    webPage.Response.Clear();
    webPage.Response.Buffer = true;
    webPage.Response.Charset = "";
    webPage.EnableViewState = false;

    string filename = "spreadsheet.xls";
    webPage.Response.ContentType = "application/vnd.ms-excel";
    webPage.Response.ContentEncoding = Encoding.Default;
    webPage.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName + ";");

    string filePath = string.Format("{0}temp\\{1}", webPage.Request.PhysicalApplicationPath, fileName);
    populate(filePath);

    webPage.Response.TransmitFile(filePath);
    webPage.Response.Flush();
    File.Delete(filePath);

    webPage.Response.End();
}



Thanks to all who wanted to help! Smile | :)
Rafferty

GeneralNeed help with adding jquery datepicker on asp usercontrol Pin
ysfkel25-Feb-10 13:44
ysfkel25-Feb-10 13:44 
GeneralRe: Need help with adding jquery datepicker on asp usercontrol Pin
Not Active25-Feb-10 14:06
mentorNot Active25-Feb-10 14:06 
QuestionHow to Search PartList Entity Using ASP.NET Dropdowlist and Textbox Pin
Sid Childers25-Feb-10 11:21
Sid Childers25-Feb-10 11:21 
QuestionChange border properties of ASCX from code-behind? Pin
mittalpa25-Feb-10 8:15
mittalpa25-Feb-10 8:15 
AnswerRe: Change border properties of ASCX from code-behind? Pin
Not Active25-Feb-10 9:46
mentorNot Active25-Feb-10 9:46 
GeneralRe: Change border properties of ASCX from code-behind? Pin
Nasri871-Mar-10 21:26
Nasri871-Mar-10 21:26 
AnswerRe: Change border properties of ASCX from code-behind? Pin
carlecomm2-Mar-10 18:06
carlecomm2-Mar-10 18:06 
QuestionHelp with RSS feed C# Pin
DaithiBoo25-Feb-10 7:16
DaithiBoo25-Feb-10 7:16 
AnswerRe: Help with RSS feed C# [modified] Pin
i gr825-Feb-10 19:36
i gr825-Feb-10 19:36 
Questionlist item Pin
FEMDEV25-Feb-10 3:07
FEMDEV25-Feb-10 3:07 
Questionhow to publish website through IIS Pin
hi_everybody25-Feb-10 2:27
hi_everybody25-Feb-10 2:27 
AnswerRe: how to publish website through IIS Pin
R. Giskard Reventlov25-Feb-10 2:47
R. Giskard Reventlov25-Feb-10 2:47 
AnswerRe: how to publish website through IIS Pin
Abhijit Jana25-Feb-10 3:19
professionalAbhijit Jana25-Feb-10 3:19 
AnswerRe: how to publish website through IIS Pin
Brij25-Feb-10 6:25
mentorBrij25-Feb-10 6:25 
GeneralRe: how to publish website through IIS Pin
hi_everybody25-Feb-10 19:49
hi_everybody25-Feb-10 19:49 
QuestionNo results.. please try again message Pin
DaithiBoo25-Feb-10 1:02
DaithiBoo25-Feb-10 1:02 
AnswerRe: No results.. please try again message Pin
Dinesh Mani25-Feb-10 1:20
Dinesh Mani25-Feb-10 1:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.