AmrishDeep

Hi,
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



Re: JScript for the .NET Framework IFrame not getting Created!

AmrishDeep

Hi,
Actually had found the issue which was rather trivial! The page which i was trying to access "FileDownload.aspx fileID=2550" was at up one level. So the code worked fine when i set the source attribute to "../FileDownload.aspx fileID=2550"