Wie Zu Öffnen-Download-Dialog-box in Javascript?

Ich machen-Funktion in der Aspx-Seite und rufen Sie diese Funktion aus java-script , Nun möchte ich die download-Dateien über den Java-script. Aber Download-Dialog nicht Öffnet.....

Download.Aspx:

            string pid = Request.QueryString["Did"].ToString();

            DataTable dt;
            dt = common.GetFilePath(Convert.ToInt64(pid));
            FilePath = dt.Rows[0]["FilePath"].ToString();
            FileName = dt.Rows[0]["FileName"].ToString();
            FilePath = System.Web.HttpContext.Current.Server.MapPath("~//" + FilePath +    "");

            Response.Clear();
            Response.ClearHeaders();
            Response.ContentType = "application/ms-excel";
            Response.AddHeader("content-disposition", "attachment; filename=" + FileName + "");
            Response.WriteFile(FilePath);
            Response.End();

Jquery:

function DownloadAttach(pid){

   $.ajax({ type: "POST",
            url: "http://localhost:1988/DownLoad.aspx?Did=" + pid,
            dataType: "xml",

            processData: true,
            //error: function(XMLHttpRequest, textStatus, errorThrown) { ajaxError(XMLHttpRequest, textStatus, errorThrown); },
            success: function(xml) {

              //ShowMsg("projSaveMsg", "Attachment Deleted.");
            }
        });        

}
InformationsquelleAutor Mayur Borad | 2011-08-19
Schreibe einen Kommentar