jamessus 0 Newbie Poster

Hey everyone,

I have a bit of an issue....I have a link:

<span class='deleteimg ui-icon ui-icon-search' style='cursor:pointer;margin-left:24px;' onclick=DownloadAssetPath();></span>

I have a jquery function:

function DownloadAssetPath() {
    var link = "/Controls/Advertiser/Ads.ashx?Download";
    window.open(link);
}

and I have a private void in C#:

private void Download()
    {
        

        String FileName = "webSitePlan.txt";
        String FilePath = "http://www.jamessuske.com/"; //Replace this
        System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
        response.ClearContent();
        response.Clear();
        response.ContentType = "text/plain";
        response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");
        response.TransmitFile(FilePath);
        response.Flush();
        response.End();
    }

What I am trying to do is, when the user clicks the button, to call the jquery function to call the C# private void and to have a download dialog box pop up. I have been really struggling with this one...if anyone can help, that would be just awesome!

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.