Essential Studio for Asp.Net | Demos

SHOWCASE SAMPLES
Showcase samples
    Spreadsheet / Default
    <%@ Page Title="Spreadsheet-Default-ASP.NET-SYNCFUSION"   Language="C#" AutoEventWireup="true" MetaDescription="This demo shows default Functionalities of Syncfusion ASP.NET Web Spreadsheet control" CodeBehind="DefaultFunctionalities.aspx.cs" MasterPageFile="~/Samplebrowser.Master" Inherits="WebSampleBrowser.SpreadsheetASP.DefaultFunctionalities" %>
    
    <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="HeadSection">
        <script src="../Scripts/jquery.validate.min.js" type="text/javascript"></script>
        <script src="../Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
        <link href="../Content/Spreadsheet/SpreadsheetStyles.css" rel="stylesheet" />
    </asp:Content>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="SampleHeading" runat="server">
        <span class="sampleName">Spreadsheet / Default</span>
    </asp:Content>
    
    <asp:Content ID="ControlContent" runat="server" ContentPlaceHolderID="ControlsSection">
        <div>
            <ej:Spreadsheet ID="FlatSpreadsheet" OnServerExcelExporting="Spreadsheet_ServerExcelExporting" OnServerCsvExporting="Spreadsheet_ServerCsvExporting" OnServerPdfExporting="Spreadsheet_ServerPdfExporting"  runat="server">
                <ClientSideEvents LoadComplete="loadComplete" OpenFailure="openfailure" />
                <ScrollSettings Height="540"/>
                <ImportSettings ImportMapper="SpreadsheetHandler.ashx" />
            </ej:Spreadsheet>
        </div>
    </asp:Content>
    
    <asp:Content ID="Content3" ContentPlaceHolderID="ScriptSection" runat="server">
        <script type="text/javascript">
            function loadComplete(args) {
                var xlFormat = this.XLFormat;
                if (!this.model.isImport) {
                    this.setWidthToColumns([142, 132, 110, 105, 102, 112, 122, 122, 102]);
                    xlFormat.format({ "style": { "font-weight": "bold" } }, "A1:H1");
                    xlFormat.format({ "type": "currency" }, "E2:H11");
                    this.XLRibbon.updateRibbonIcons();
                }
            }
            function openfailure(args) {
                this.alert(args.statusText);
            }
        </script>
    </asp:Content>
    
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using WebSampleBrowser.SpreadsheetASP.Model;
    using Syncfusion.EJ.Export;
    using Syncfusion.XlsIO;
    
    namespace WebSampleBrowser.SpreadsheetASP
    {
        public partial class DefaultFunctionalities : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    BindDataSource();
                }
            }
    
            private void BindDataSource()
            {
                var dataSource = ItemData.GetAllItemDetails.ToList();
                this.FlatSpreadsheet.Sheets.Add(new Syncfusion.JavaScript.Models.Sheet()
                {
                    Datasource = dataSource
                });
            }
    
            [Serializable]
            public class Orders
            {
                public Orders()
                {
                }
                public Orders(long OrderId, string CustomerId, int EmployeeId, string ShipCity, string ShipName, string ShipCountry)
                {
                    this.OrderID = OrderId;
                    this.CustomerID = CustomerId;
                    this.EmployeeID = EmployeeId;
                    this.ShipName = ShipName;
                    this.ShipCity = ShipCity;
                    this.ShipCountry = ShipCountry;
                }
                public long OrderID { get; set; }
                public string CustomerID { get; set; }
                public int EmployeeID { get; set; }
                public string ShipCity { get; set; }
                public string ShipName { get; set; }
                public string ShipCountry { get; set; }
            }
    
            protected void Spreadsheet_ServerExcelExporting(object sender, Syncfusion.JavaScript.Web.SpreadsheetEventArgs e)
            {
                var args = e.Arguments;
                string password = args["password"].ToString();
                string sheetModel = args["sheetModel"].ToString();
                string sheetData = args["sheetData"].ToString();
                string fileName = args["fileName"].ToString();
    
                if (!string.IsNullOrEmpty(password))
                    
                    Spreadsheet.Save(sheetModel, sheetData, fileName, ExportFormat.XLSX, ExcelVersion.Excel2013, password);
                else
                    Spreadsheet.Save(sheetModel, sheetData, fileName, ExportFormat.XLSX, ExcelVersion.Excel2013);
            }
    
            protected void Spreadsheet_ServerCsvExporting(object sender, Syncfusion.JavaScript.Web.SpreadsheetEventArgs e)
            {
                var args = e.Arguments;
                Spreadsheet.Save(args["sheetModel"].ToString(), args["sheetData"].ToString(), args["fileName"].ToString(), ExportFormat.CSV);
            }
    
            protected void Spreadsheet_ServerPdfExporting(object sender, Syncfusion.JavaScript.Web.SpreadsheetEventArgs e)
            {
                var args = e.Arguments;
                Spreadsheet.Save(args["sheetModel"].ToString(), args["sheetData"].ToString(), args["fileName"].ToString(), ExportFormat.PDF);
            }
    
        }
    }
    namespace WebSampleBrowser.SpreadsheetASP.Model
    {
        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Web;
        using System.ComponentModel;
    
        public class ItemData
        {
            public string ItemName { get; set; }
            public string Date { get; set; }
            public string Time { get; set; }
            public int Quantity { get; set; }
            public int Price { get; set; }
            public int Amount { get; set; }
            public int Discount { get; set; }
            public int Profit { get; set; }
            public string StockDetail { get; set; }
            public string Website { get; set; }
            public static IEnumerable<object> GetAllItemDetails
            {
                get
                {
                    List<ItemData> lItems = new List<ItemData>();
    
                    lItems.Add(new ItemData() { ItemName = "Casual Shoes", Date = "02/14/2014", Time = "11:34:32 AM", Quantity = 10, Price = 20, Amount = 200, Discount = 1, Profit = 10 });
                    lItems.Add(new ItemData() { ItemName = "Sports Shoes", Date = "06/11/2014", Time = "05:56:32 AM", Quantity = 20, Price = 30, Amount = 600, Discount = 5, Profit = 50 });
                    lItems.Add(new ItemData() { ItemName = "Formal Shoes", Date = "07/27/2014", Time = "03:32:44 AM", Quantity = 20, Price = 15, Amount = 300, Discount = 7, Profit = 27 });
                    lItems.Add(new ItemData() { ItemName = "Sandals & Floaters", Date = "11/21/2014", Time = "06:23:54 AM", Quantity = 15, Price = 20, Amount = 300, Discount = 11, Profit = 67 });
                    lItems.Add(new ItemData() { ItemName = "Flip- Flops & Slippers", Date = "06/23/2014", Time = "12:43:59 AM", Quantity = 30, Price = 10, Amount = 300, Discount = 10, Profit = 70 });
                    lItems.Add(new ItemData() { ItemName = "Sneakers", Date = "07/22/2014", Time = "10:55:53 AM", Quantity = 40, Price = 20, Amount = 800, Discount = 13, Profit = 66 });
                    lItems.Add(new ItemData() { ItemName = "Running Shoes", Date = "02/04/2014", Time = "03:44:34 AM", Quantity = 20, Price = 10, Amount = 200, Discount = 3, Profit = 14 });
                    lItems.Add(new ItemData() { ItemName = "Loafers", Date = "11/30/2014", Time = "03:12:52 AM", Quantity = 31, Price = 10, Amount = 310, Discount = 6, Profit = 29 });
                    lItems.Add(new ItemData() { ItemName = "Cricket Shoes", Date = "07/09/2014", Time = "11:32:14 AM", Quantity = 41, Price = 30, Amount = 1210, Discount = 12, Profit = 166 });
                    lItems.Add(new ItemData() { ItemName = "T-Shirts", Date = "10/31/2014", Time = "12:01:44 AM", Quantity = 50, Price = 10, Amount = 500, Discount = 9, Profit = 55 });
    
                    var itemCol =
                    from item in lItems
                    select new { item.ItemName, item.Date, item.Time, item.Quantity, item.Price, item.Amount, item.Discount, item.Profit };
    
                    return itemCol;
                }
            }
        }
    }