Initial commit
This commit is contained in:
125
Grid/GridFeatures.aspx
Normal file
125
Grid/GridFeatures.aspx
Normal file
@@ -0,0 +1,125 @@
|
||||
<%@ Page Language="C#" MasterPageFile="~/Site.Master" Title="Grid" AutoEventWireup="true" CodeBehind="GridFeatures.aspx.cs" Inherits="QW2021C.GridFeatures" %>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
|
||||
<h2>Grid Features:</h2>
|
||||
<br />
|
||||
<li> Grid Samples - Default</li>
|
||||
<li> Filtering</li>
|
||||
<li> Sorting</li>
|
||||
<li> Paging</li>
|
||||
<li> Selection - Single</li>
|
||||
<li> Column Resizing</li>
|
||||
<li> Frozen Rows and Columns</li>
|
||||
<li> Custom Toolbar</li>
|
||||
<li> Keyboard Interaction</li>
|
||||
<li> Column Chooser</li>
|
||||
<li> Allow Wrap</li>
|
||||
<li> Header Template</li>
|
||||
<li> Scrolling</li>
|
||||
<li> Export</li>
|
||||
<li> Summary</li>
|
||||
<li> Editing Type - Inline Editing</li>
|
||||
<li> Localization - en-US</li>
|
||||
<li> Theme - Gradient-Lime</li>
|
||||
<br/>
|
||||
<script src='<%= Page.ResolveClientUrl("~/Scripts/ej/i18n/ej.culture.en-US.min.js")%>' type="text/javascript"></script>
|
||||
<script src='<%= Page.ResolveClientUrl("~/Scripts/ej/l10n/ej.localetexts.en-US.min.js")%>' type="text/javascript"></script>
|
||||
<div id = "ControlRegion">
|
||||
<div class="frame ">
|
||||
<div>
|
||||
<ej:Grid ID="Grid1" AllowSorting="true" AllowPaging="True"
|
||||
AllowScrolling="True" AllowResizing="True"
|
||||
EnableRowHover="true" AllowFiltering="True" AllowTextWrap="True" AllowCellMerging="false"
|
||||
ShowColumnChooser="true" AllowReordering="false" Locale="en-US" AllowMultiSorting="false"
|
||||
OnServerWordExporting="FlatGrid_ServerWordExporting" OnServerPdfExporting="FlatGrid_ServerPdfExporting"
|
||||
OnServerExcelExporting="FlatGrid_ServerExcelExporting"
|
||||
AllowSelection="True" Selectiontype="Single"
|
||||
ShowSummary="True" runat="server">
|
||||
<SummaryRows>
|
||||
<ej:SummaryRow Title="Sum">
|
||||
<SummaryColumn>
|
||||
<ej:SummaryColumn SummaryType="Sum" Format="{0:C}" DisplayColumn="Freight" DataMember="Freight" />
|
||||
</SummaryColumn>
|
||||
</ej:SummaryRow>
|
||||
<ej:SummaryRow Title="Average">
|
||||
<SummaryColumn>
|
||||
<ej:SummaryColumn SummaryType="Average" Format="{0:C}" DisplayColumn="Freight" DataMember="Freight" />
|
||||
</SummaryColumn>
|
||||
</ej:SummaryRow>
|
||||
<ej:SummaryRow Title="Smallest">
|
||||
<SummaryColumn>
|
||||
<ej:SummaryColumn SummaryType="Minimum" Format="{0:C}" DisplayColumn="Freight" DataMember="Freight" />
|
||||
</SummaryColumn>
|
||||
</ej:SummaryRow>
|
||||
<ej:SummaryRow Title="Largest">
|
||||
<SummaryColumn>
|
||||
<ej:SummaryColumn SummaryType="Maximum" Format="{0:C}" DisplayColumn="Freight" DataMember="Freight" />
|
||||
</SummaryColumn>
|
||||
</ej:SummaryRow>
|
||||
</SummaryRows>
|
||||
<Columns>
|
||||
<ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" IsFrozen="True" TextAlign="Right" Width="90" />
|
||||
<ej:Column Field="CustomerID" HeaderText="Customer ID" IsFrozen="True" Width="100" />
|
||||
<ej:Column Field="EmployeeID" HeaderText="Employee ID" HeaderTemplateID="#employeeTemplate" TextAlign="Right" Width="110" />
|
||||
<ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="90" Format="{0:C}" />
|
||||
<ej:Column Field="OrderDate" HeaderText="Order Date" Width="100" HeaderTemplateID="#dateTemplate" TextAlign="Right" Format="{0:MM/dd/yyyy}" />
|
||||
<ej:Column Field="ShipCity" HeaderText="Ship City" Width="100" />
|
||||
</Columns>
|
||||
<ClientSideEvents ToolbarClick="onToolBarClick" />
|
||||
<ToolbarSettings ShowToolbar="True" ToolbarItems="excelExport,wordExport,pdfExport, add,edit,delete,update,cancel">
|
||||
<CustomToolbarItem>
|
||||
<ej:CustomToolbarItem TemplateID="#Refresh" />
|
||||
</CustomToolbarItem>
|
||||
</ToolbarSettings>
|
||||
<ScrollSettings Height="330" Width="550" FrozenRows="1"></ScrollSettings>
|
||||
<PageSettings PageSize="15" />
|
||||
<EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings>
|
||||
<SelectionSettings EnableToggle="true" />
|
||||
<FilterSettings FilterBarMode="Immediate" ShowFilterBarStatus="True" StatusBarWidth="300"></FilterSettings>
|
||||
</ej:Grid>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
});
|
||||
$(document).on("keydown", function (e) {
|
||||
if (e.altKey && e.keyCode === 74) {
|
||||
$("#Grid1").focus();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script id="dateTemplate" type="text/x-jsrender">
|
||||
<span class="date headericon"></span>Order Date
|
||||
</script>
|
||||
<script id="employeeTemplate" type="text/x-jsrender">
|
||||
<span class="headericon employee"></span>Emp ID
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.headericon {
|
||||
background-image: url(../Content/Images/Grid/icons-gray.png);
|
||||
padding-left: 20px;
|
||||
}
|
||||
.date {
|
||||
background-position: -3px -86px;
|
||||
}
|
||||
.employee {
|
||||
background-position: -82px -62px;
|
||||
}
|
||||
</style>
|
||||
<style type="text/css" class="cssStyles">
|
||||
.refresh {
|
||||
background-position: -76px 3px;
|
||||
background-image: url("../Content/Images/Grid/icons-gray.png");
|
||||
}
|
||||
</style>
|
||||
<script id="Refresh" type="text/x-jsrender">
|
||||
<a class="e-toolbaricons refresh" />
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function onToolBarClick(sender, args) {
|
||||
var tbarObj = $(sender.target);
|
||||
if (tbarObj.hasClass("refresh"))
|
||||
this.refreshContent();
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</asp:Content>
|
||||
83
Grid/GridFeatures.aspx.cs
Normal file
83
Grid/GridFeatures.aspx.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using Syncfusion.EJ.Export;
|
||||
using Syncfusion.XlsIO;
|
||||
using System;
|
||||
using Syncfusion.JavaScript;
|
||||
using Syncfusion.JavaScript.DataSources;
|
||||
using Syncfusion.JavaScript.Models;
|
||||
using Syncfusion.JavaScript.Web;
|
||||
using Syncfusion.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.Services;
|
||||
using System.Web.Script.Services;
|
||||
namespace QW2021C
|
||||
{
|
||||
public partial class GridFeatures : System.Web.UI.Page
|
||||
{
|
||||
public static List<Orders> order = null;
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
BindDataSource();
|
||||
}
|
||||
private void BindDataSource()
|
||||
{
|
||||
order = new List<Orders>();
|
||||
int orderId = 10000;
|
||||
int empId = 0;
|
||||
for (int i = 1; i < 9; i++)
|
||||
{
|
||||
order.Add(new Orders(orderId + 1, "VINET", empId + 1, 32.38, new DateTime(2014, 12, 25), "Reims"));
|
||||
order.Add(new Orders(orderId + 2, "TOMSP", empId + 2, 11.61, new DateTime(2014, 12, 21), "Munster"));
|
||||
order.Add(new Orders(orderId + 3, "ANATER", empId + 3, 45.34, new DateTime(2014, 10, 18), "Berlin"));
|
||||
order.Add(new Orders(orderId + 4, "ALFKI", empId + 4, 37.28, new DateTime(2014, 11, 23), "Mexico"));
|
||||
order.Add(new Orders(orderId + 5, "FRGYE", empId + 5, 67.00, new DateTime(2014, 05, 05), "Colchester"));
|
||||
order.Add(new Orders(orderId + 6, "JGERT", empId + 6, 23.32, new DateTime(2014, 10, 18), "Newyork"));
|
||||
orderId += 6;
|
||||
empId += 6;
|
||||
}
|
||||
this.Grid1.DataSource = order;
|
||||
this.Grid1.DataBind();
|
||||
}
|
||||
[Serializable]
|
||||
public class Orders
|
||||
{
|
||||
public Orders()
|
||||
{
|
||||
}
|
||||
public Orders(int orderId, string customerId, int empId, double freight, DateTime orderDate, string shipCity)
|
||||
{
|
||||
this.OrderID = orderId;
|
||||
this.CustomerID = customerId;
|
||||
this.EmployeeID = empId;
|
||||
this.Freight = freight;
|
||||
this.OrderDate = orderDate;
|
||||
this.ShipCity = shipCity;
|
||||
}
|
||||
public int OrderID { get; set; }
|
||||
public string CustomerID { get; set; }
|
||||
public int EmployeeID { get; set; }
|
||||
public double Freight { get; set; }
|
||||
public DateTime OrderDate { get; set; }
|
||||
public string ShipCity { get; set; }
|
||||
}
|
||||
protected void FlatGrid_ServerExcelExporting(object sender, Syncfusion.JavaScript.Web.GridEventArgs e)
|
||||
{
|
||||
ExcelExport exp = new ExcelExport();
|
||||
exp.Export(Grid1.Model, (IEnumerable)Grid1.DataSource, "Export.xlsx", ExcelVersion.Excel2010, true, true, "flat-lime");
|
||||
}
|
||||
protected void FlatGrid_ServerWordExporting(object sender, Syncfusion.JavaScript.Web.GridEventArgs e)
|
||||
{
|
||||
WordExport exp = new WordExport();
|
||||
exp.Export(Grid1.Model, (IEnumerable)Grid1.DataSource, "Export.docx", true, true, "flat-lime");
|
||||
}
|
||||
protected void FlatGrid_ServerPdfExporting(object sender, Syncfusion.JavaScript.Web.GridEventArgs e)
|
||||
{
|
||||
PdfExport exp = new PdfExport();
|
||||
exp.Export(Grid1.Model, (IEnumerable)Grid1.DataSource, "Export.pdf", true, true, "flat-lime");
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Grid/GridFeatures.aspx.designer.cs
generated
Normal file
20
Grid/GridFeatures.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
namespace QW2021C {
|
||||
public partial class GridFeatures {
|
||||
/// <summary>
|
||||
/// FlatGrid control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::Syncfusion.JavaScript.Web.Grid Grid1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user