-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDefault.aspx
More file actions
60 lines (53 loc) · 2.47 KB
/
Default.aspx
File metadata and controls
60 lines (53 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="OpenPdfOrImage.Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function OnSelectedFileOpened(s, e) {
let filename = e.file.GetFullName();
let shortFilename = filename.split('\\').pop();
let extension = filename.split('.').pop();
if (extension == "pdf") {
image.SetVisible(false);
panel.SetVisible(true);
pdf_template.src = filename;
}
else {
image.SetVisible(true);
panel.SetVisible(false);
image.SetImageUrl(filename);
}
PopupWithDocument.SetHeaderText("Preview: " + shortFilename);
PopupWithDocument.Show();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<dx:ASPxFileManager ID="MyFileManager" ClientInstanceName="MyFileManager" runat="server">
<Settings RootFolder="~\Content" ThumbnailFolder="~\Thumb\" />
<SettingsUpload Enabled="false" />
<ClientSideEvents SelectedFileOpened="OnSelectedFileOpened" />
</dx:ASPxFileManager>
<dx:ASPxPopupControl AllowResize="true" ID="PopupWithDocument" ClientInstanceName="PopupWithDocument" runat="server"
PopupHorizontalAlign="WindowCenter" AllowDragging="true" PopupVerticalAlign="WindowCenter" AutoUpdatePosition="true"
CloseAction="CloseButton" ContentStyle-HorizontalAlign="Center">
<ContentCollection>
<dx:PopupControlContentControl runat="server">
<dx:ASPxImage ID="ASPxImage1" runat="server" ShowLoadingImage="true" ClientVisible="false"
ClientInstanceName="image"></dx:ASPxImage>
<dx:ASPxPanel ID="ASPxPanel1" runat="server" ClientVisible="false"
ClientInstanceName="panel">
<PanelCollection>
<dx:PanelContent>
<embed id="pdf_template" type='application/pdf' width="500" height="600"/>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxPanel>
</dx:PopupControlContentControl>
</ContentCollection>
</dx:ASPxPopupControl>
</form>
</body>
</html>