FineUI/FineUI.Examples/grid/grid_groupheader.aspx.cs
三生石上 8e116609c6 v4.2.0
2015-05-19 14:45:47 +08:00

76 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using System.IO;
namespace FineUI.Examples.grid
{
public partial class grid_groupheader : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
}
#region BindGrid
private void BindGrid()
{
Grid1.DataSource = GetDataTable();
Grid1.DataBind();
}
protected new DataTable GetDataTable()
{
DataTable table = new DataTable();
table.Columns.Add(new DataColumn("Guid", typeof(Guid)));
table.Columns.Add(new DataColumn("Year", typeof(int)));
table.Columns.Add(new DataColumn("HZData1", typeof(int)));
table.Columns.Add(new DataColumn("HZData2", typeof(int)));
table.Columns.Add(new DataColumn("HLData1", typeof(int)));
table.Columns.Add(new DataColumn("HLData2", typeof(int)));
table.Columns.Add(new DataColumn("AHData1", typeof(int)));
table.Columns.Add(new DataColumn("AHData2", typeof(int)));
table.Columns.Add(new DataColumn("LogTime", typeof(DateTime)));
DataRow row;
Random rd = new Random();
for (int i = 0; i < 10; i++)
{
int year = 2000 + i;
row = table.NewRow();
row[0] = Guid.NewGuid();
row[1] = year;
row[2] = rd.Next(1000, 9999);
row[3] = rd.Next(1000, 9999);
row[4] = rd.Next(1000, 9999);
row[5] = rd.Next(1000, 9999);
row[6] = rd.Next(1000, 9999);
row[7] = rd.Next(1000, 9999);
row[8] = DateTime.Parse(String.Format("{0}-09-01", year));
table.Rows.Add(row);
}
return table;
}
#endregion
}
}