HI krm0503,
There are two example, please create a folder name "Uploads" under the root of your site to start test the examples.
1 will update the images every uploaded
- <%@ Page Language="C#" %>
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
- <script runat="server">
-
-
- protected override void OnPreRender(EventArgs e)
- {
- SubmitButton.Attributes["itemcount"] = Uploader1.Items.Count.ToString();
-
- base.OnPreRender(e);
- }
-
-
- protected void Uploader1_UploadCompleted(object sender, UploaderEventArgs[] args)
- {
-
- DataTable dt = new DataTable();
- dt.Columns.Add(new DataColumn("src", typeof(String)));
- DataRow dr;
- for (int i = 0; i < args.Length; i++)
- {
- args[i].CopyTo("~/Uploads/" + args[i].FileName);
- dr = dt.NewRow();
- dr[0] = "~/Uploads/" + args[i].FileName;
- dt.Rows.Add(dr);
-
- }
- DataView dv = new DataView(dt);
- DataList1.DataSource = dv;
- DataList1.DataBind();
-
-
-
- }
- </script>
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>Start uploading manually</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <CuteWebUI:UploadAttachments runat="server" ManualStartUpload="true" ID="Uploader1"
- OnUploadCompleted="Uploader1_UploadCompleted">
- </CuteWebUI:UploadAttachments>
- <br />
- <asp:Button runat="server" ID="SubmitButton" OnClientClick="return submitbutton_click()"
- Text="Submit" />
- <asp:DataList ID="DataList1" runat="server">
- <ItemTemplate>
- <asp:Image ID="image1" runat="server" ImageUrl='<%# Eval("src") %>' />
- </ItemTemplate>
- </asp:DataList>
-
- <script type="text/javascript">
-
-
- function submitbutton_click()
- {
-
- var uploadobj=document.getElementById('<%=Uploader1.ClientID %>');
- var submitbutton=document.getElementById('<%=SubmitButton.ClientID %>');
-
- if(!window.filesuploaded)
- {
- if(uploadobj.getqueuecount()>0)
- {
- uploadobj.startupload();
- }
- else
- {
- var uploadedcount=parseInt(submitbutton.getAttribute("itemcount"))||0;
- if(uploadedcount>0)
- {
- return true;
- }
- alert("Please browse files for upload");
- }
- return false;
- }
- window.filesuploaded=false;
- return true;
- }
- function CuteWebUI_AjaxUploader_OnPostback()
- {
- window.filesuploaded=true;
- var submitbutton=document.getElementById('<%=SubmitButton.ClientID %>');
- submitbutton.click();
- return false;
- }
- </script>
-
- </form>
- </body>
- </html>
2 will show all images you uploaded
Regards,
ken