I am working on ASP.NET Web form application. My requirement is to show excel file download popupbox when user clicks on the given link (This link is on poppage not on aspx
It's not possible to save a file using ajax. It will get the data but the download dialog will never be shown. See Download a file by jQuery.Ajax for more information.
I recently had a similar requirement myself and ended up having the javascript Excel download function create a form on the page dynamically (with the action pointing to the .ashx handler that generates the Excel file). The function then populated the form with hidden inputs containing any parameters required by the .ashx handler and then finally submitting it.
An example based on what I did:
function ExportExcel() {
var formFragment = document.createDocumentFragment();
var form = document.createElement("form");
$(form).attr("action", baseUrl + "/WebServices/ExtraInfoWebService.asmx/Urlhttphandler")
.attr("method", "POST");
var inputField = document.createElement("input");
$(inputField).attr("type", "hidden")
.attr("id", "someId")
.attr("name", "someId")
.val(3);
form.appendChild(inputField);
formFragment.appendChild(form);
$("body").append(formFragment);
$(form).submit();
};