15,911,531 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Sam Jenifa (Top 2 by date)
Sam Jenifa
15-Nov-12 6:40am
View
I used a plugin by referring this link(http://johnculviner.com/post/2012/03/22/Ajax-like-feature-rich-file-downloads-with-jQuery-File-Download.aspx).
In the plugin they used iframe. The file to be placed in the hidden iframe, because of that it shows the file download dialog box. The last code which i post, has some error. I directly passed the response get from the handler.
Now I changed the code like this.
JQuery:
function CallHandler() {
$.ajax({
url: "iss_report.ashx",
contentType: "application/json; charset=utf-8",
success: OnComplete,
error: OnFail
});
return false;
}
function OnComplete(result) {
$.fileDownload('report/report.PDF');
}
function OnFail(result) {
alert('Request failed');
}
Handler:
public class iss_report : IHttpHandler {
public iss_report()
{
}
public void ProcessRequest (HttpContext context) {
Workbook wb= new Workbook();
string file = ConfigurationManager.AppSettings["pdfreportlocation"].ToString() + "\\report.PDF";
context.Response.SetCookie(new HttpCookie("fileDownload", "true") { Path = "/" });
invoicebook.Save(file);
}
public bool IsReusable {
get {
return false;
}
}
Every steps are working fine.But I didn't get file download dialog box or any error message. In the status bar a message blink for a second that start downloading... But nothing happened.
Sam Jenifa
15-Nov-12 4:39am
View
Thanks for your reply.
Ya, it doesn't work.File download error occurs. How to resolve it?? plz help me.