Click here to Skip to main content
15,911,531 members

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.