From: Iain on
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

From: Alexey Smirnov on
On Oct 1, 5:00 pm, Iain <i...(a)test.co.uk> 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
From: Iain on
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.
From: Alexey Smirnov on
On Oct 1, 5:14 pm, Iain <i...(a)test.co.uk> 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
From: Iain on
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.