


The first step is determining the locations of the Desktop and Recent Files folders. Response.WriteFile(Server.MapPath("~/PDFs/" + () + ".pdf" )) ĬommandArgument will hold the filename (from the database, for the current row in the grid).depending on whether you have the extension stored along with the filename you may want to append or remove ".pdf" in the code (lnk.CommandArgument + ". The basic approach used is to create a Link (.Lnk) file in the Recent Files folder, move the file to the Desktop folder, then tell Windows to refresh the Desktop so the shortcut appears. Response.AddHeader("content-disposition", "attachment filename=" + lnk.CommandArgument + ".pdf") Protected void OpenPDF(object sender, EventArgs e) The easiest way to create a shortcut is to add it to the recent documents list, and then move it to where you want it to go. In the codebehind write the event handler OpenPDF: Creating a shortcut in VB is far more complicated than it should be. You could replace the text of the linkbutton with the name of the file too (instead of OpenPDF, '")%>') typically you'd have only the pdf filename stored in the database while file itself is in a folder, say 'PDFs'.you could use a LinkButton with an Image: ' ImageUrl="~/images/folder.jpg" runat="server"> Do you have the complete url to the pdf file? you could use a HyperLink
