losing selection from dropdownlist when paging

G

Guest

I have a search textbox for entering search value. I use with OnCommand event
in an ImageButton to set the SqlCommand string manually in the OnCommand
method.

When I click on a page number other than the first page the Gridview acts as
if the default SqlCommand was in being used and shows all rows instead of the
ones determined by a where clause. In other words, my custom SqlCommand is
not persisting when the Pager navigation is being used.

Any suggestions on how this should be handled would be appreciated.

Thanks.
 
G

Guest

Are you re-binding the data every time the PAgeLoad event occurs, have you
tried putting the initial databinding in a if (!IsPostBack) condtion.
 
G

Guest

The OnCommand event of the button fires only once and sets the SqlCommand
during that one postback. You have to persist that search condition in the
Session object and reset it while handling the page.init if the Session
variable is not null.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,252
Latest member
MeredithPl

Latest Threads

Top