//将数据存放在Session中
privatevoidInitLoadTable()
{
DataTabledTable=newDataTable();
dTable.Columns.Add("ID",typeof(int));
dTable.Columns.Add("Name",typeof(string));
//添加数据
DataRowdRow=dTable.NewRow();
dRow["ID"]=4;
dRow["Name"]="第";
dTable.Rows.Add(dRow);
DataRowdRow1=dTable.NewRow();
dRow1["ID"]=2;
dRow1["Name"]="zxp";
dTable.Rows.Add(dRow1);
//保存到sexxion中
Session["Table"]=dTable;
}
publicstringSessionTable="";
//获取取
privatevoidGetSessionTable()
{
DataTabledTable=newDataTable();
dTable=(DataTable)Session["Table"];
StringBuilderstrApp=newStringBuilder();
foreach(DataRowdRowindTable.Rows)
{
strApp.Append(dRow["ID"].ToString());
}
SessionTable=strApp.ToString();
}