<% @ Page language = "c #" autoeventwireup = "true" debug = "true"%>
Void Page_Load (Object Sender, Eventargs E) {
// Page initialization
IF (! page.ispostback) {
PageSize.text = "10";
PageIndex.Text = "0";
Numberpage.checked = true;
MyDataGrid.currentpageIndex = 0;
MyDataGrid.pageSize = 15;
MyDataGrid.pagerstyle.Mode = Pagermode.NumericPages;
}
DataSource (); // function call
}
//data source
Void DataSource () {
Hashtable ht = new hashtable ();
Ht.Add ("12345", "microft");
Ht.Add ("56789", "IMNDKSDF");
Ht.Add ("9856", "lsdjflksjdl");
Ht.Add ("6345646", "lskjdflksjdlkfjslkdf");
Ht.Add ("3463", "SDVSDGSRGSDF");
Ht.Add ("23", "wfgdfhdfjfj");
Ht.Add ("63456443256", "kuyoghjfg");
HT.ADD ("2214", "Eyeryryh");
HT.Add ("6546456", "rutykhfg");
Ht.Add ("67567", "wwryerhh");
Ht.Add ("442", "fjfgj");
HT.ADD ("2345436", "NBMBM");
Ht.Add ("235346", "fghfgn");
Ht.Add ("567567568", "sdgsdtewt");
Ht.Add ("567", "hyjgh");
Ht.Add ("3453456", "Jhluyk");
Ht.Add ("945434553", "rs);
Ht.Add ("34634", "ewegegthtjyjtyiktyktyk";
MyDataGrid.dataSource = HT;
MyDataGrid.databind ();
}
// page page change function
Void PageChange (Object Sender, DataGridPageChangeDeventArgs E) {
MyDataGrid.currentpageIndex = E.NewpageIndex;
MyDataGrid.databind ();
}
/ / As a pages function
Void NumberPageClick (Object Sender, Eventargs E) {
Fontspage.checked = false;
MyDataGrid.pagerstyle.Mode = PagerMode.NuMericPages; DataSource ();
}
// Make the page function as a character
Void FontspageClick (Object Sender, Eventargs E) {
Numberpage.checked = false;
MyDataGrid.pagerstyle.Mode = PagerMode.NextPrev;
MyDataGrid.pagersty.nextPageText = "Next";
MyDataGrid.pagerstyle.prevpageText = "prev";
DataSource ();
}
// page index function
Void IndexClick (Object Sender, Eventargs E) {
MyDataGrid.currentpageIndex = int32.parse (pageIndex.text);
DataSource ();
}
/ / How many rows of functions are displayed per page
Void SizeClick (Object Sender, Eventargs E) {
MyDataGrid.pageSize = int32.parse (Pagesize.Text);
DataSource ();
}
Script>