Solution implementation
After analyzing the above, let's see how to implement him:
Class DataInfo: This class is used to save data status, in general, that is, each
DataGrid corresponds to one:
[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;
}
///
/// data name
/// summary>
Public String DataName
{
Get {return Dataname;}
}
///
/// query parameters
/// summary>
Public HashTable searchParams
{
Get {return searchparams;}
Set {searchparams = value;
}
///
/// Get other parameters
/// summary>
Public HashTable Otherparams
{
Get {return Otherparams;
Set {ioparams = value;
}
///
/// Get the current page
/// summary>
Public int currentpage
{
Get {return currentpage;
Set {currentpage = value;
}
///
/// Get sorting method
/// summary>
Public String Sortexpression
{
Get {return sortexpression;}
Set {sortexpression = value;}
}
///
/// Get the ID of the item to be displayed in the current page
/// summary>
Public String ItemID
{
Get {return itemid;}
Set {itemid = value;}
}
}
Class DataInfolist: This class package bearer
DataInfo's dynamic array, defining the data type of the array input output
[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 || this [value.dataname] == NULL)
{
DataInfolist [Index] = VALUE
}
Else
{
Throw new Exception ("There Have A DataInfo Used this name yet!");
}
}
Public DataInfo this [String Dataname]
{
get
{
For (int i = 0; i { IF (this [i] .dataname == Dataname) { Return this [i]; } } Return NULL; } set { For (int i = 0; i { IF (this [i] .dataname == Dataname) { THIS [I] = Value; Return; } } THIS.ADD (VALUE); } } Public Void Remove (DataInfo Value) { DataInfolist.remove (Value); } Public Void Remove (String Dataname) { DataInfo DataInfo = this [dataname]; IF (DataInfo! = NULL) { DataInfolist.remove (DataInfo); } } Public Bool Contains (DataInfo Value) { Return DataInfolist.Contains (Value); } Public Bool Contains (String DataName) { DataInfo DataInfo = this [dataname]; IF (DataInfo! = NULL) { Return True; } Return False; } Public void clear () { DataInfolist.clear (); } Public Int Add (DataInfo Value) { IF (this [value.dataname] == NULL) { Return DataInfolist.Add (Value); } Else { Throw new Exception ("There Have A DataInfo Used this name yet!"); } } Public Int Count { get { Return DataInfolist.count; } } } Interface ipageInfo: This interface is used in the page to implement data communication between the page. Public Interface ipageInfo { /// /// page name /// summary> String Pagename { Get; } /// /// Get data information /// summary> DataInfolist DataInfos { Get; } /// /// Get other parameters /// summary> Hashtable Otherparams { Get; } } (Endlessly)