I have an requirement where on a click of a link I need to create an iFrame which directs to a different page which sends a file from the server for download!
On click event of the asp:link button, I register the Javascript function which creates a iFrame and appends it to the document's body. But the source mentioned in th iFrame is not getting trigerred at all!
//Registering the Javascript Function
lnkFilePreview.Attributes.Add("onclick", "DownloadFile('" + dgFileList.ClientID + "'); return false;");
Javascript function
//FUNCTION TO DOWNLOAD THE SELECTED FILE
function DownloadFile(fileID)
{
var contr=document.getElementById(fileID);
var iframe = document.createElement("iframe");
iframe.setAttribute("src", "FileDownload.aspx fileID=2550");
iframe.setAttribute("id", "previewdownloadFrames");
dcount++;
iframe.setAttribute("scrolling", "no");
iframe.setAttribute("frameBorder", "0");
iframe.setAttribute("width", "0");
document.body.appendChild(iframe);
return false;
}
I dont have any clue as to why this is not working!
-Amrish