» Posted by noname at 07/03/2008 19:49:38
» Language: ASPX
« Previous - Next »
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register Assembly="Wilco.Web.Silverlight" Namespace="Wilco.Web.Silverlight" TagPrefix="wilco" %>
<script runat="server" language="C#">
void AsyncFileUpload1_FilesUploaded(object sender, UploadEventArgs e) {
StringBuilder msg = new StringBuilder("Uploaded files:");
msg.AppendLine();
foreach (string path in e.FilePaths) {
msg.AppendFormat("- {0}", System.IO.Path.GetFileName(path));
msg.AppendLine();
}
messageLabel.Text = msg.ToString().Replace(Environment.NewLine, "<br />");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>AsyncFileUpload Demo</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ul>
<li>
<a href="/Wilco/Pastecode/7587/showpaste.aspx">CustomTemplate.aspx (source)</a>
</li>
<li>
<a href="/Wilco/Pastecode/4556/showpaste.aspx">Web.config (source)</a>
</li>
<li>
<a href="/Wilco/Silverlight/file-upload-component-for-Silverlight-and-ASP-NET.aspx">Related article</a>
</li>
</ul>
<wilco:SilverlightDomain runat="server" ID="myDomain">
<div style="margin-bottom: 20px">
<h1>Async file upload (custom template)</h1>
<asp:Label ID="messageLabel" runat="server" Text="Try uploading a few files... Also try uploading a file partially, and then try to upload it again, either in your current
sesison or another browser session (or even within a different supported browser on your machine)." />
</div>
<wilco:AsyncFileUpload ID="AsyncFileUpload1" runat="server" EnableMultipleSelection="true"
Filter="Media Files|*.wmv;*.wma;*.avi;*.mp3|Word Documents|*.doc|Text Files|*.txt|C# files|*.cs|Libraries|*.dll|All Files|*.*"
OnFilesUploaded="AsyncFileUpload1_FilesUploaded">
<LayoutTemplate>
<asp:Button ID="SelectFilesButton" runat="server" Text="Browse..." />
<div id="FileContainer" runat="server">
Not uploading anything yet...
</div>
</LayoutTemplate>
<FileTemplate>
<div>
<button id="RemoveButton" runat="server">X</button>
<span id="FileNameLabel" runat="server"><!-- File name --></span>
<div style="display: inline; width: 150px">
<div id="ProgressBar" runat="server" style="background-color: #bbb; height: 20px; width: 0px"></div>
</div>
</div>
</FileTemplate>
</wilco:AsyncFileUpload>
<wilco:AsyncFileUploadVisualizer ID="AsyncFileUploadVisualizer" runat="server" UploaderID="AsyncFileUpload1" PreviewEnabled="false" />
<wilco:AsyncFileUploadProgressVisualizer ID="AsyncFileUploadProgressVisualizer" runat="server" UploaderID="AsyncFileUpload1" />
<wilco:GridViewPort ID="GridViewPort1" runat="server" Height="200px" Width="100%">
<ColumnDefinitions>
<wilco:ColumnDefinition Width="2*" />
<wilco:ColumnDefinition Width="1*" />
</ColumnDefinitions>
<Locations>
<wilco:GridViewPortItem ControlID="AsyncFileUploadVisualizer" Column="0" />
<wilco:GridViewPortItem ControlID="AsyncFileUploadProgressVisualizer" Column="1" />
</Locations>
</wilco:GridViewPort>
</wilco:SilverlightDomain>
</div>
</form>
</body>
</html>
|
|