For the first time, forget the annotation, I can't help.
using System; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; using System.Data; using System.Xml; namespace Grid {public class IDArgs: System.EventArgs {private string id; / / Constructor. // public idargs (string id) {this.id = id;} // the numends proty;} the alarm clock has selfeded. // public String ID {get {return this.id;}}} ///
/// summary description for WebcustomControl1. ///
[DefaultProperty ( "Text"), ToolboxData ( "<{0}: WebCustomControl1 runat = server>")] public class WebCustomControl1: System.Web.UI.WebControls.WebControl, IPostBackEventHandler {public string EditUrl {get {if (this. ViewState ["editurl"]! = Null) Return (String) this.viewState ["editurl"]; else return ";} set {this.viewstate [" editurl "] = value;}} public string expandColumn}} public string expandcolumn}} IF (this.viewState]! = null) Return (String) this.viewState ["expandColumn"]; else return ";} set {this.viewState [" expandColumn "] = value;}} // Set Paging Public Int ISPAGING {Get {IF (this.viewState ["ispaging"]! = null) r ETURN (ISPAGING "]; Else Return 0;} set {this.viewState [" ispaging "] = value;}} public int pagecount {get {ix (this.viewstate [" pagecount "]! = NULL) RETURN (Int) this.viewState ["PageCount"]; Else Return 0;} set {this.viewState ["PageCount"] = value;
}}} Public int currentpage {get {i (this.viewState ["currentpage"]! = Null) Return (int) this.viewstate ["currentpage"]; else return 1;} set {this.viewState ["currentpage"] = Value;}} // set sort public int} {get {i (this.viewState ["ssort"]! = null) return (int) this.viewState ["ssort"]; else return 0;} set {THIS .ViewState ["issort"] = value;}} public int sortcolumn {get {ife (this.viewState ["sortcolumn"]! = Null) Return (int) this.viewState ["sortcolumn"]; else return1; } Set {this.viewstate ["sortcolumn"] = value; } Public string sortColumnName {(! This.ViewState [ "sortColumnName"] = null) get {if return (string) this.ViewState [ "sortColumnName"]; else return "";} set {this.ViewState [ "sortColumnName"] = Value;}} public string sortorder {get {ix (this.viewState ["sortorder"]! = null) Return (String) this.viewState ["Sortorder"];
Else Return "ASC";} set {this.viewState ["Sortorder"] = value;}} public dataset source {get {return (dataset) this.viewState ["Source"];} set {this.viewstate ["Source "] = value;}} public event eventhandler delete; public void raisepostDataChangeDevent () {// iPostBackDataHandler Agreement. If you have returned from the loadPostData method // (indicating that a change notification is required) is called. This method is just an empty operation because // always returns.
} // protected void onchange (Eventargs e) // {// sort (this, e); //} public void raisepostbackevent (String Eventargument) {if (Eventargument.indexof ("|")> - 1) {iDARGS IDE = New idargs (Eventargument.inDexof ("|") 1); if (delete! = null) {delete (this, IDE);} return;} String flag = "; switch (Eventargument) {CASE "first": this.currentpage = 1; break; case "prev": this.currentpage -; break; case "next": this.currentpage ; break; case "last": this.currentpage = THIS .PageCount; Break; Case ": Break; default: {dataable d T = source.tables [0]; int lastColumn = SortColumn; for (int i = 0; Iif (Eventargument == DT.COLUMNS [i] .columnname)
{
Sortcolumn = i;
Break;
}
IF (LastColumn == SortColumn) {if (this.Sortorder == "DESC") Sortorder = "ASC"; Else Sortorder = "DESC";
Else Sortorder = "ASC";
Sortcolumnname = Eventargument;
Break;
}
}
// if (Flag == "sort")
// {
// if (this.issort == 0)
// {
// Return;
//} //}
IF (refresh! = null) refresh (this, eventargs.empty);
}
Private string writScipt ()
{
String script = @ "
???? ???? ???? ???? ????? var? currentdiv;
????????????????????? Var? currentimg;
?????????????????????? function? Expand (Obj, Flag)
????????????????????? {
????????????????????
?????????????????????? Var? DDD = document.getlementByid (FLAG);
??????????????????????? f (ddd.style.display? == ') {ddd.style.display? =' none '; obj.innerText = '5' ?;}
?????????????????????????????? Else? {ddd.style.display? = '';? obj.innertext = '6' ?;}
???? ???? ???? ???? ????? f? (currentdiv! = null? &&? currentdiv.style.display? == '' &&? currentdiv! = DDD?)
????????????????????????? {
?????????????????????????? currentdiv.style.display? = 'None';?
???????????????? correntimg.innertext = '5';
??????????????????????????}?
??????????????????????? currentdiv = ddd ?;
????????????????????? currentimg = OBJ
??????????????????????}
???????????????????? script>
String style = @ "
????? ???? ???? ???? ???? Table? {? font-size:? 12px;? border:? 0px?;? border-color :? # 99cc99? # 99cc99 ? #Cccccc? #Ccccccc;? Cellspacing: 1;? Bgcolor: #eeeee;? Text-decoration: ???????? ???? ????. Sorttitle? { Font-size:? 20px; Background-Color: # ffcc99; color:? blue; cursor:? Hand} .title? {? font-size:? 20px; Background-color: # ffcc99} ???? ?? ?? ?? ???? ???? ????. main? {? background-color: #ddddddd} ???? ???? ???????? ????. divclass? { • Background-color: # ffcc99} ???? ???? ???? ???? ????. Gray {color:? gray; font-size:? small; ?? font-family :? Webdings} ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? Font-Family:? WebDings; Cursor:? HAND } ?????????????????????. expand {font-size:? x-small;? color:? black;? font-family:? webdings; cursor:? Hand} ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? x Hand} ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? :? Hand} ???? ???? ???????????, ";
Return Script style;
}
Private string writelist ()
{
int [] columnWidth = new int {20, 100, 100, 100, 0};
DataTable DT = Source.tables [0];
String Title = (this.issort == 0)? "Title": "sorttitle";
String List = "
"
IF (ExpandColumn! = "") List = "
"
IF (this.issort == 1)
{
String Sortstr = "";
String sortflag = (this.Sortorder == "ASC")? "5": "6";
// set header and sort
For (int J = 1; J
{
IF (sortcolumn == j)
{
Sortstr = "
" Sortflag "
"
}
Else Sortstr = "";
IF (ColumnWidth [J] == 0)
List = "
Else
List = "
" DT.COLUMNS [J] .Columnname Sortstr " "
}
}
Else
{
For (int J = 1; J
{
IF (ColumnWidth [J] == 0)
List = "
" DT.COLUMNS [J] .columnname " "
Else
List = "
" DT.COLUMNS [J] .columnname " "
}
}
List = "
L ";
List = "
"
List = "
"
For (int i = 0; i
{
List = "
"
// Expand column
IF (ExpandColumn! = ")
List = "
// delete column
List = "
// Edit Column
List = "
For (int J = 1; J
{
List = "
" DT.ROWS [I] [J] .tostring ()";
}
List = "";
// Expand Display
IF (ExpandColumn! = ")
List = "
DESC
" DT.ROWS [I] [ExpandColumn] .tostring () "
"
}
List = "
"
IF (this.ispaging == 0) Return List;
// set pageing
String paning = "";
IF (PageCount <2)
Paging = "
9 |
3 |
4 |
"
Else
{
IF (this.currentpage == 1)
Paging = "
9 |
3 |
4 |
"
Else IF (this.currentpage == this.pagecount)
Paging = "
9 |
3 |
4 |
"
Else
Paging = "
9 |
3 |
4 |
"
}
List = "
Total:
" this.pagecount "
Page:
" this.currentpage "
PAGING
Return List;
}
///
/// render this control to the output parameter specified. ///
///
The Html Writer to Write Out To
Protected Override Void Render (HTMLTextWriter Output)
{
Output.write (WRITESCIPT ());
Output.write (WriteList ());
}
}
}