Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gridview Filtering disappears on paging

Status
Not open for further replies.

HJBPS

Programmer
Apr 25, 2008
8
US
I have a gridview bound to a SQLdatasource.
I have a dropdown and a refresh button.
When I select a value from the dropdown, I set a filterexpression and click refresh. This refreshes the gridview and shows me the filtered data. as soon as I click on page 2, the filtered data disappears and all the data comes back to the grid. How do I maintain the filtering between paging.
Please help.
 
You have to call your databinding method on each postback that includes the filtering. Your best bet is to not use the datasource controls because you can't debug them. You should create a DAL and use that to bind to your grid.
 
jb, I am new to asp.net. Please explain what is DAL and how to use it. Appreciated.
 
i believe, paging, sorting and filters are not held between postbacks, so with each postback you need to apply them and possibly store them in viewstate, session, etc.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top