解决方法的实现
以上分析过了之后,我们来看如何实现他:
class DataInfo:这个类用于保存数据状态,一般而言,也就是每个DataGrid对应一个:
[Serializable()]
public class DataInfo
{
private string dataName;
private Hashtable searchParams;
private Hashtable otherParams;
private int currentPage;
private string sortExpression;
private string itemID;
public DataInfo(string dataName)
{
this.dataName = dataName;
}
/// <summary>
/// 数据名
/// </summary>
public string DataName
{
get { return dataName; }
}
/// <summary>
/// 查询参数
/// </summary>
public Hashtable SearchParams
{
get { return searchParams; }
set { searchParams = value; }
}
/// <summary>
/// 获取其他参数
/// </summary>
public Hashtable OtherParams
{
get { return otherParams; }
set { otherParams = value; }
}
/// <summary>
/// 获取当前页
/// </summary>
public int CurrentPage
{
get { return currentPage; }
set { currentPage = value; }
}
/// <summary>
///获取排序方式
/// </summary>
public string SortExpression
{
get { return sortExpression ;}
set { sortExpression = value; }
}
/// <summary>
/// 获取要显示在当前页的项的ID
/// </summary>
public string ItemID
{
get { return itemID; }
set { itemID = value; }
}
}
class DataInfoList:这个类包装承载DataInfo的动态数组,限定数组输入输出的数据类型
[Serializable()]
public class DataInfoList
{
private ArrayList dataInfoList = new ArrayList();
public DataInfo this[int index]
{
get
{
return (DataInfo)dataInfoList[index];
}
set
{
if (((DataInfo)dataInfoList[index]).DataName == value.DataName
关键词:页面无限跳转间如何保存页面状态(2)