2015-05-19 14:45:47 +08:00
|
|
|
|
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_twogrid : PageBase
|
|
|
|
|
{
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
BindGrid2();
|
|
|
|
|
|
|
|
|
|
BindGrid1();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region BindGrid2/BindGrid1
|
|
|
|
|
|
|
|
|
|
private void BindGrid2()
|
|
|
|
|
{
|
2016-01-10 01:19:30 -05:00
|
|
|
|
Grid2.DataSource = DataSourceUtil.GetClassDataTable();
|
2015-05-19 14:45:47 +08:00
|
|
|
|
Grid2.DataBind();
|
|
|
|
|
|
|
|
|
|
Grid2.SelectedRowIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BindGrid1()
|
|
|
|
|
{
|
|
|
|
|
if (Grid2.SelectedRowIndex < 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int classId = Convert.ToInt32(Grid2.DataKeys[Grid2.SelectedRowIndex][0]);
|
|
|
|
|
|
|
|
|
|
DataTable table = null;
|
|
|
|
|
if (classId == 101)
|
|
|
|
|
{
|
2016-01-10 01:19:30 -05:00
|
|
|
|
table = DataSourceUtil.GetDataTable();
|
2015-05-19 14:45:47 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2016-01-10 01:19:30 -05:00
|
|
|
|
table = DataSourceUtil.GetDataTable2();
|
2015-05-19 14:45:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
|
|
|
|
UpdateClassDesc(classId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void UpdateClassDesc(int classId)
|
|
|
|
|
{
|
2016-01-10 01:19:30 -05:00
|
|
|
|
foreach (DataRow row in DataSourceUtil.GetClassDataTable().Rows)
|
2015-05-19 14:45:47 +08:00
|
|
|
|
{
|
|
|
|
|
int currentClassId = (int)row["Id"];
|
|
|
|
|
if (classId == currentClassId)
|
|
|
|
|
{
|
|
|
|
|
labelClassDesc.Text = row["Desc"].ToString();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Events
|
|
|
|
|
|
2016-01-10 01:19:30 -05:00
|
|
|
|
protected void Grid2_RowSelect(object sender, GridRowSelectEventArgs e)
|
2015-05-19 14:45:47 +08:00
|
|
|
|
{
|
|
|
|
|
BindGrid1();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|