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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Grid - ColSorting and Paging

Status
Not open for further replies.

onedizzydevil

Programmer
Mar 24, 2001
103
US
Problem: Using OnSortCommand and OnPageIndexChanged datagrid events. When I select a page then Sort I stay on current page; however, when I Sort then change the page it will not retain the sort order.

Any one know how to fix this? OR, does any know how to get the current sortExpression, if that is even possible. Wayne Sellars

"Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0."
 
Hi Wayne,

How I did it was store the the sortfield in a hidden label in the form and then pass the sortfield to the sub that binds the data. Then you can pass the value of the label to the data-binding sub in the PageIndexChanged event.

I hope I explained that clearly (few beers).

I'm sure there is an article on it on 4Guys or something, have a search and I'll see if I can find it too.

[smurf]
01101000011000010110010001110011
 

Thanks, I actually though about doing it that way while I was trying to sleep last night. Eventhough it is a fairly simple thing to do I found the above article that explains the steps.

Hope it of value to other people. Wayne Sellars

"Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0."
 
I have moved on put that is a very important and very useful piece information to know about.

Thanks Wayne Sellars

"Programming, today is a race between software developers, striving to build bigger and better idiot-proof programs, and the Universe, trying to produce bigger and better idiots. So far, Universe 1 - Programmers 0."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top