Initial commit
This commit is contained in:
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user