using Paging in Datagrid

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
 
B

Benjie Fallar

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top