using Paging in Datagrid

  • Thread starter Thread starter Yangtsi River
  • Start date Start date
Y

Yangtsi River

Hi,
I am adding a paging function to a datagrid control, the datasource is a
DataSet Object. Based on some articles, I just add some attributes to
datagrid, ie.
Allowpaging=true,Pagesize=5,PagerStyle-Mode="numbericPages",
it is nice that it worked , page index appeared.
But when I clicked the page index,no paging effect appeared, on the web
page is the same record as the first view.

I got some conflicting instruction on this,some say u just need add some
attrubutes,since the datagrid support paging itself, while other say u still
need
add some sub for an event on PageindexChanged and rebind the new data again.

who is right? since it support paging,why Can't I use it by just adding
some paging attributes.

Thanx
Yangtsi
 
on the PageIndexChanged event, add the following line of codes

dataGrid1.currentPageIndex = e.NewPageIndex
dataAdapter1.Fill(myDataset)

dim dv as new DataView
dv = myDataset.Tables(0).DefaultView
dv.sort = e.SortExpression

dataGrid1.dataSource = dv
dataGrid1.dataBind()
 
Back
Top