Reputation: 6316
I have a button like below which in charge of opening an image in top of the ASP.NET application.
<asp:Button
ID="MatrixButton"
runat="server"
Text="Risk Matrix"
CausesValidation="False"
OnClientClick="openImageDoc('Images/RiskMatrixCapitalAllocation.jpg', 'RiskMatrix')"/>
Now I need to have another button to do the same function but this time opens a PDF file
<asp:Button
ID="AnalysisButton"
runat="server"
Text="Risk Analysis"
CausesValidation="False"
OnClientClick="openPDFDoc('PDF/RiskAnalysis.pdf.jpg', 'RiskAnalysis')"/>
Here is the JavaScript:
function openPDFDoc(filePath, titleName) {
var newUrl = baseUrl + filePath;
window.open(newUrl, titleName, 'width=900,height=800,scrollbars=1');
}
Upvotes: 0
Views: 1394
Reputation: 26209
You need to remove the extension .jpg
from the path.
Replace This:
PDF/RiskAnalysis.pdf.jpg
With This:
PDF/RiskAnalysis.pdf
Upvotes: 1