一个自定义的可以分页,排序,扩展显示grid控件

80酷酷网    80kuku.com

  分页|控件|排序|显示第一次写,忘记注解,对不住.

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 NumRings property returns the number of rings
// that the alarm clock has sounded when the alarm event
// is generated.
//
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
{
get
{
if(this.ViewState["ExpandColumn"]!=null) return (string)this.ViewState["ExpandColumn"];
else return "";
}
set
{
this.ViewState["ExpandColumn"]=value;
}
}

//set paging

public int IsPaging
{
get
{
if(this.ViewState["IsPaging"]!=null) return (int)this.ViewState["IsPaging"];
else return 0;
}
set
{
this.ViewState["IsPaging"]=value;
}
}

public int PageCount
{
get
{
if(this.ViewState["PageCount"]!=null) return (int)this.ViewState["PageCount"];
else return 0;
}
set
{
this.ViewState["PageCount"]=value;
}
}

public int CurrentPage
{
get
{
if(this.ViewState["CurrentPage"]!=null) return (int)this.ViewState["CurrentPage"];
else return 1;
}
set
{
this.ViewState["CurrentPage"]=value;
}
}

//set sort
public int IsSort
{
get
{
if(this.ViewState["IsSort"]!=null) return (int)this.ViewState["IsSort"];
else return 0;
}
set
{
this.ViewState["IsSort"]=value;
}
}

public int sortColumn
{
get
{
if(this.ViewState["sortColumn"]!=null) return (int)this.ViewState["sortColumn"];
else return -1;
}
set
{
this.ViewState["sortColumn"]=value;
}
}



public string sortColumnName
{
get
{
if(this.ViewState["sortColumnName"]!=null) return (string)this.ViewState["sortColumnName"];
else return "";
}
set
{

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: