I have a String variable (in C#) that contain the full path of PDF file on my server (like that \"~/doc/help.pdf\").
I want that in click on button, this file will down
With an ASP button:
button.OnClientClick = string.Format("javascript:window.location='{0}'", pdfLink);
The logic behind this is here: Client-side click
This will not reload the page and do a post-back, it will just navigate to the PDF which will be displayed in the browser.
Set the button's onclick event to this scriptlet:
onclick="javascript:window.location='/doc/help.pdf'"
To create that server-side:
Where PDFLink is a string property in the code behind:
public string PDFLink
{
get
{
return "/doc/link.pdf";
}
}
From here it should be trivial to take the string from the database and render it absolute if need be.