Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I have an webapplication in which the use can view his records in the grid view and on click on reference id will popup an modal popup which displays the full details of Reference id clicked. there is one export to pdf button exists within the modal pop up which should return the document to the user.

My problem is onclick of the button will generate the report but fails to display file save/open dialog to user.(the same code works fine with single page but not with AJAX modal popup)

my code is:

C#
Context.Response.Clear();
        Context.Response.ContentType = "application/pdf";
        Context.Response.AddHeader("Content-Disposition", "attachment;filename=Test.pdf");
        Context.Response.Write("Hi");
        Context.Response.Flush();
 Context.Response.End();



please help me if any body having idea to download a file within ajax modal popup.

Thanks,

Vasanth
Posted

You have to create a http handler for this and call this handler from java script
 
Share this answer
 
Comments
vasumagadi 4-Oct-11 8:54am    
Hi Ram,

this solution works perfectly for me :)

Thanks for your help.

Vasanth
MalathiMals 21-Jul-16 1:46am    
now i also have same problem. I also followed same method. but this solution i can't understand how to implement
C#
Response.Clear()
           Response.Buffer = True
           Response.ContentType = "application/pdf"
           Response.AddHeader("content-disposition", "attachment; filename=Test ")
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900