Essential Studio for Asp.Net | Demos

SHOWCASE SAMPLES
Showcase samples
    <%@ Page Title="UploadBox-Drag And Drop-ASP.NET-SYNCFUSION" Language="C#" MasterPageFile="~/Samplebrowser.Master" AutoEventWireup="true" CodeBehind="DragAndDrop.aspx.cs" Inherits="WebSampleBrowser.UploadBox.Dranganddrop" %>
    
    
    <asp:Content ID="Content3" ContentPlaceHolderID="StyleSection" runat="server">
        <style type="text/css">
            .frame {
                width: 500px;
                height: 100px;
                margin-top: 10%;
            }
    
            .control {
                width: 100%;
                height: 100%;
            }
    
            .cols-sample-area {
                position: relative;
            }
        </style>
    </asp:Content>
    <asp:Content ID="Content5" ContentPlaceHolderID="ControlsSection" runat="server">
        <div class="frame">
            <div class="control">
                <ej:UploadBox ID="Upload1" runat="server" AllowDragAndDrop="true" MultipleFilesSelection="true" SaveUrl="saveFiles.ashx" RemoveUrl="removeFiles.ashx"></ej:UploadBox>
            </div>
        </div>
    </asp:Content>
    <asp:Content ID="Content6" ContentPlaceHolderID="ScriptSection" runat="server">
    <script>
    document.addEventListener('dragover',function(event){
        event.preventDefault();
        event.dataTransfer.dropEffect = 'none';
        return false;
        },false);
        document.addEventListener('drop',function(event){
        event.dataTransfer.dropEffect = 'none';
        event.preventDefault();
        return false;
      },false);
    </script>
    </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 Dranganddrop : 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;
                }
            }
        }
    }