GridView - problem with paging

Discussion in 'ASP .Net' started by Iain, Oct 1, 2009.

  1. Iain

    Iain Guest

    All,

    When changing the display of a GridView with :

    SqlDataSource1.SelectCommand = "SELECT ....blah blah"
    SqlDataSource1.DataBind();

    After the result set changes within the Gridview the paging no longer
    works, is there a way to re-page the control so it works correctly on
    the newly displayed data.

    Regards
    Iain
     
    Iain, Oct 1, 2009
    #1
    1. Advertising

  2. On Oct 1, 5:00 pm, Iain <> wrote:
    > All,
    >
    > When changing the display of a GridView with :
    >
    >            SqlDataSource1.SelectCommand = "SELECT ....blah blah"
    >            SqlDataSource1.DataBind();
    >
    > After the result set changes within the Gridview the paging no longer
    > works, is there a way to re-page the control so it works correctly on
    > the newly displayed data.
    >
    > Regards
    > Iain


    What do you mean, why it no longer works? You probably need to set
    PageIndex back to 0. Please look here for more examples:
    http://msdn.microsoft.com/en-us/library/aa479347.aspx
     
    Alexey Smirnov, Oct 1, 2009
    #2
    1. Advertising

  3. Iain

    Iain Guest

    Alexey Smirnov wrote:
    >
    > What do you mean, why it no longer works? You probably need to set
    > PageIndex back to 0. Please look here for more examples:
    > http://msdn.microsoft.com/en-us/library/aa479347.aspx


    Clicking on the pages seems to revert back to the previous result set.
    I'll have a look at the suggested example!

    Cheers Alexey.
     
    Iain, Oct 1, 2009
    #3
  4. On Oct 1, 5:14 pm, Iain <> wrote:
    > Alexey Smirnov wrote:
    >
    > > What do you mean, why it no longer works? You probably need to set
    > > PageIndex back to 0. Please look here for more examples:
    > >http://msdn.microsoft.com/en-us/library/aa479347.aspx

    >
    > Clicking on the pages seems to revert back to the previous result set.
    > I'll have a look at the suggested example!
    >
    > Cheers Alexey.


    It would be good to see your code. Maybe I can find the error there
     
    Alexey Smirnov, Oct 1, 2009
    #4
  5. Iain

    Iain Guest

    Alexey Smirnov wrote:
    >>
    >> Cheers Alexey.

    >
    > It would be good to see your code. Maybe I can find the error there


    Code below, in a simplfied form :

    I have a Button & a TextBox on a form and on the click of the button I
    perform the following :

    SqlDataSource1.SelectCommand = "SELECT id from mytable where name = '" +
    TextBoxSearch.Text + "'";
    SqlDataSource1.DataBind();

    After applying the above the GridView refreshes as expected BUT clicking
    on the page numbers within the GridView doesn't work as expected, it
    displays records from the previous search.
     
    Iain, Oct 2, 2009
    #5
    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,870
    Scott Allen
    Oct 8, 2004
  2. Random

    GridView Paging problem

    Random, Dec 16, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    997
    Random
    Dec 16, 2004
  3. wh1974
    Replies:
    0
    Views:
    2,492
    wh1974
    Jan 12, 2005
  4. Red
    Replies:
    1
    Views:
    769
  5. yefei
    Replies:
    5
    Views:
    13,813
    Aytaç ÖZAY
    Apr 14, 2006
Loading...

Share This Page