|
Datagridpaging(please help me) -- RavinderReddy --
I am not getting the next page of the database when i clik on next button.Iam having 7 rows in my sql database.i am getting only firstpage with 5 rows.i want to display nextpage by cliking next button. I write the code as if (datagrid1.currentpageindex<datagrid1.pagecount-1) { datagrid1.currentpageindex+=1; } else { } |
|
-- Bharathi --
In the datagrid PageIndexChanged Event write the code: (datagrid1.currentpageindex<datagrid1.pagecount-1) { datagrid1.currentpageindex+=1; datagrid1.datasource = ds datagrid1.databind() } |
|
-- Sevinfooter --
you must rebind the datagrid. usually you would would call whatever method that you used to bind it in the first place. also, in your paging function, you can use the properties of your event args. in vb: sub your_pageindexchanged(byval sender as object, byval e as eventargs) datagrid1.currentpageindex = e.newpageindex somedatabindfunction() end sub |
|
-- Sevinfooter --
you need to: datagrid1.currentpageindex = e.newPageIndex where e is EventArgs for the OnPageIndexChanged event. then, you must rebind your datagrid. the way you have it set up would work if you bind your datagrid after you increment the current page index, but it would not allow you to go to previous pages |