1;
public ViewDB()
{
this.Init+=new EventHandler(this.Page_Init);
}
public void Page_Init(object sender,EventArgs e)
{
this.Load+=new EventHandler(this.Page_Load);
this.dataGrid1.PageIndexChanged+=new
DataGridPageChangedEventHandler(this.DataGrid1_PageIndexChanged);
}
public void Page_Load(object sender,EventArgs e)
{
ViewDBService viewDBService=new ViewDBService();
//使用webservice
dataGrid1.DataSource=viewDBService.ViewDB().Tables["NoteBoard"].DefaultView;
if(!Page.IsPostBack)
{
dataGrid1.CurrentPageIndex=0;
dataGrid1.DataBind();
}
}
public void DataGrid1_PageIndexChanged(object sender,DataGridPageChangedEventArgs e)
{
dataGrid1.CurrentPageIndex=e.NewPageIndex;
dataGrid1.DataBind();
}
}
}