using Paging in Datagrid

Discussion in 'ASP .Net' started by Yangtsi River, Jul 9, 2003.

  1. 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
     
    Yangtsi River, Jul 9, 2003
    #1
    1. Advertising

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



    "Yangtsi River" <> wrote in message
    news:u%...
    > 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
    >
    >
     
    Benjie Fallar, Jul 9, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    DataSet paging vs Datareader paging

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    10,702
    Scott Allen
    Oct 8, 2004
  2. Roger
    Replies:
    0
    Views:
    963
    Roger
    Dec 28, 2004
  3. wh1974
    Replies:
    0
    Views:
    2,439
    wh1974
    Jan 12, 2005
  4. Red
    Replies:
    1
    Views:
    723
  5. Green Start Button

    DataGrid.Items.Count and DataGrid Paging...

    Green Start Button, Aug 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    5,817
    agravar
    Aug 2, 2006
Loading...

Share This Page