A customized page, sort, extended display GRID control

zhaozj2021-02-16  65

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 = @ "