Paging using Gridview and ObjectDataSource

I have a GridView that I page using ObjectDataSource:

  <asp:ObjectDataSource ID="ObjectDataSource1" EnablePaging="true"
      runat="server" SelectCountMethod="GetRowCount"
      SelectMethod="BindControl" TypeName="DAO"
      StartRowIndexParameterName="startRowIndex" 
MaximumRowsParameterName="maximumRows">
  </asp:ObjectDataSource>


This works fine and my paging it done on the Server instead of letting the 
GridView handle it so I get only the data I need.

The problem is that if a dropdown is changed, I need to change the 
parameters I send to the server including reseting the page number.

Right now what happens is that the page number will be the same as it was 
when I last bound the Grid.  So if the last page I was on was 4, the next 
time I bind it will also be 4.

How do I change it back to 1?

Is that done from ObjectDataSource or the GridView?

Thanks,

Tom 


0
tshad
2/4/2010 9:58:29 PM
dotnet.framework.aspnet 1425 articles. 0 followers. Follow

1 Replies
1941 Views

Similar Articles

[PageSpeed] 25

Try setting the selected item back to -1

-- 
Vapordan
Shameless Author Plug
ASP.NET 4 by Example only $20
OWC Blackbook www.lulu.com/owc

"tshad" <t@dslextreme.com> wrote in message 
news:##RwwUepKHA.1548@TK2MSFTNGP06.phx.gbl...
> I have a GridView that I page using ObjectDataSource:
>
>  <asp:ObjectDataSource ID="ObjectDataSource1" EnablePaging="true"
>      runat="server" SelectCountMethod="GetRowCount"
>      SelectMethod="BindControl" TypeName="DAO"
>      StartRowIndexParameterName="startRowIndex" 
> MaximumRowsParameterName="maximumRows">
>  </asp:ObjectDataSource>
>
>
> This works fine and my paging it done on the Server instead of letting the 
> GridView handle it so I get only the data I need.
>
> The problem is that if a dropdown is changed, I need to change the 
> parameters I send to the server including reseting the page number.
>
> Right now what happens is that the page number will be the same as it was 
> when I last bound the Grid.  So if the last page I was on was 4, the next 
> time I bind it will also be 4.
>
> How do I change it back to 1?
>
> Is that done from ObjectDataSource or the GridView?
>
> Thanks,
>
> Tom
> 
0
Alvin
2/14/2010 3:31:47 AM
Reply:

Similar Artilces: