Use a lot of viewState to save status when writing controls, for example:
Public String CurrentPageIndex {
Get {
Return ViewState ["CurrentPageIndex"]. TOSTRING ();
}
SET {
ViewState ["CurrentPageIndex"] = Value;
}
}
Many tutorials use the above ways, there will be errors when practical applications, and the specifically when using this control, the property will report an error: not applying the object to the instance!
Change this.
Public String CurrentPageIndex {
Get {
Object obj = viewstate ["currentpageindex"];
Return (obj == null)? String.empty: obj.tostring ();
}
SET {
ViewState ["CurrentPageIndex"] = Value;
}
}