Essential Studio for Asp.Net | Demos

SHOWCASE SAMPLES
Showcase samples
    Enable / Disable
    Multiple Files Selection
    <%@ Page Title="UploadBox-API's-ASP.NET-SYNCFUSION" Language="C#" MasterPageFile="~/Samplebrowser.Master" AutoEventWireup="true" CodeBehind="APIs.aspx.cs" Inherits="WebSampleBrowser.UploadBox.APIs" %>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="ScriptSection" runat="server">
        <script type="text/javascript">
            var target;
            $(function () {
                $("#check1").ejCheckBox({ "change": "OnCheck" ,"checked":"true"});
                target = $("#<%=Upload1.ClientID%>").data("ejUploadbox");
                $("#enableButton").ejToggleButton({
                    defaultText: "Disable",
                    activeText: "Enable",
                    size: "normal",
                    change: "onCheckUncheckAll",
                    width:"110px"
                });
                $("#sampleProperties").ejPropertiesPanel();
            });
            function onCheckUncheckAll(args) {
                if (args.isChecked)
    
                    target.disable();
                else
                    target.enable();
            }
            function OnCheck(args) {
                if (args.isChecked) {
                    target.setModel({ multipleFilesSelection: true });
                } else {
                    target.setModel({ multipleFilesSelection: false });
                }
    
            }
        </script>
    </asp:Content>
    <asp:Content ID="Content3" ContentPlaceHolderID="StyleSection" runat="server">
        <style type="text/css">
            .posupload {
                margin-left: 50px;
                margin-top: 20px;
            }
           .cols-sample-area {
                position: relative;
            }
        </style>
    </asp:Content>
    <asp:Content ID="Content5" ContentPlaceHolderID="ControlsSection" runat="server">
        <div class="frame">
            <div class="control">
                <div class="posupload">
                    <ej:UploadBox ID="Upload1" SaveUrl="saveFiles.ashx" RemoveUrl="removeFiles.ashx" runat="server" ></ej:UploadBox>
                </div>
            </div>
        </div>
    
    </asp:Content>
    <asp:Content ID="Content6" ContentPlaceHolderID="PropertySection" runat="server">
        <div id="sampleProperties">
            <div class="prop-grid">
                <div class="row">
                    <div class="col-md-6">Enable / Disable</div>
                        <div class="col-md-6">
                            <input type="checkbox" id="enableButton" class="e-togglebtn" value="checkuncheck" />
                        </div>
                    
                </div>
                <div class="row">
                    <div class="col-md-6">Multiple Files Selection</div>
                        <div class="col-md-6">
                            <input type="checkbox" id="check1" />
                        </div>
                   
                </div>
            </div>
        </div>
    </asp:Content>
    <asp:Content ID="Content7" ContentPlaceHolderID="EventSection" runat="server">
    </asp:Content>
    
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace WebSampleBrowser.UploadBox
    {
        public partial class APIs : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
        }
    }
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Web;
    
    namespace WebSampleBrowser.UploadBox
    {
        /// <summary>
        /// Summary description for saveFiles
        /// </summary>
        public class saveFiles : IHttpHandler
        {
    
            public void ProcessRequest(HttpContext context)
            {
                string targetFolder = HttpContext.Current.Server.MapPath("uploadfiles");
                if (!Directory.Exists(targetFolder))
                {
                    Directory.CreateDirectory(targetFolder);
                }
                HttpRequest request = context.Request;
                HttpFileCollection uploadedFiles = context.Request.Files;
                if (uploadedFiles != null && uploadedFiles.Count > 0)
                {
                    for (int i = 0; i < uploadedFiles.Count; i++)
                    {
                        string fileName = uploadedFiles[i].FileName;
                        int indx = fileName.LastIndexOf("\\");
                        if (indx > -1)
                        {
                            fileName = fileName.Substring(indx + 1);
                        }
                        //uploadedFiles[i].SaveAs(targetFolder + "\\" + fileName);
                    }
                }
                else
                {
    
                }
            }
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }
    }
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Web;
    
    namespace WebSampleBrowser.UploadBox
    {
        /// <summary>
        /// Summary description for removeFiles
        /// </summary>
        public class removeFiles : IHttpHandler
        {
    
            public void ProcessRequest(HttpContext context)
            {
                System.Collections.Specialized.NameValueCollection s = context.Request.Params;
                string fileName = s["fileNames"];
                string targetFolder = HttpContext.Current.Server.MapPath("uploadfiles");
                if (!Directory.Exists(targetFolder))
                {
                    Directory.CreateDirectory(targetFolder);
                }
    
                string physicalPath = targetFolder + "\\" + fileName;
                if (System.IO.File.Exists(physicalPath))
                {
                    System.IO.File.Delete(physicalPath);
                }
    
            }
    
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }
    }