78 строки
2.8 KiB
C#
78 строки
2.8 KiB
C#
#region Copyright Syncfusion Inc. 2001-2022.
|
|
// Copyright Syncfusion Inc. 2001-2022. All rights reserved.
|
|
// Use of this code is subject to the terms of our license.
|
|
// A copy of the current license can be obtained at any time by e-mailing
|
|
// licensing@syncfusion.com. Any infringement will be prosecuted under
|
|
// applicable laws.
|
|
#endregion
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
namespace WebSampleBrowser.Grid
|
|
{
|
|
public partial class GridLines : System.Web.UI.Page
|
|
{
|
|
List<Orders> order = new List<Orders>();
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
this.
|
|
BindDataSource();
|
|
Session["DataSource"] = order;
|
|
}
|
|
|
|
private void BindDataSource()
|
|
{
|
|
if ((List<Orders>)Session["DataSource"] == null)
|
|
{
|
|
int orderId = 10643;
|
|
int empId = 0;
|
|
for (int i = 1; i < 9; i++)
|
|
{
|
|
order.Add(new Orders(orderId + 1, "ALFKI", empId + 1, 32.38, "Alfreds Futterkiste ", "Germany"));
|
|
order.Add(new Orders(orderId + 2, "ANATR", empId + 2, 11.61, "Ana Trujillo Emparedados y helados", "Mexico"));
|
|
order.Add(new Orders(orderId + 3, "ANTON", empId + 3, 45.34, "Antonio Moreno Taquería", "Mexico"));
|
|
order.Add(new Orders(orderId + 4, "AROUT", empId + 4, 37.28, "Around the Horn", "UK"));
|
|
order.Add(new Orders(orderId + 5, "BERGS", empId + 5, 67.00, "Berglunds snabbköp", "Sweden"));
|
|
order.Add(new Orders(orderId + 6, "BLONP", empId + 6, 23.32, "Blondel père et fils", "France"));
|
|
orderId += 6;
|
|
empId += 6;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
order = (List<Orders>)Session["DataSource"];
|
|
}
|
|
this.OrdersGrid.DataSource = order;
|
|
this.OrdersGrid.DataBind();
|
|
}
|
|
|
|
[Serializable]
|
|
public class Orders
|
|
{
|
|
public Orders()
|
|
{
|
|
|
|
}
|
|
public Orders(int orderId, string customerId, int empId, double freight, string shipName, string shipCountry)
|
|
{
|
|
this.OrderID = orderId;
|
|
this.CustomerID = customerId;
|
|
this.EmployeeID = empId;
|
|
this.Freight = freight;
|
|
this.ShipName = shipName;
|
|
this.ShipCountry = shipCountry;
|
|
}
|
|
public int OrderID { get; set; }
|
|
public string CustomerID { get; set; }
|
|
public int EmployeeID { get; set; }
|
|
public double Freight { get; set; }
|
|
public string ShipName { get; set; }
|
|
public string ShipCountry { get; set; }
|
|
}
|
|
}
|
|
} |