Sorting issue after refresh


After sorting the DhtmlxGrid by clicking on one of the headers, and clicks on one of the button in the grid, where i am doing a database update, the page refreshes back to unsorted.

The button click is like this

function gridButtonClicked(target,argument )




this is how i am setting the button

WriteSearchResultsCell(writer, “<img src=”…/images/icn_lock.gif" style=“cursor:hand; border:0px;” alt="" + objCheckoutUser.FirstName + " " + objCheckoutUser.LastName + " Checked out at " + objRequest.CheckoutTime.ToString() + “” onclick = “gridButtonClicked(‘Lock#Edit’ ,’” + objRequest.RequestID + “’)” />", true);

I want the DhtmlxGrid should remain sorted after the page refreshes .Please help me.

Thank you in advance.


There are two ways

a) you need to attach onAfterSort event and monitor sorting state of grid, this state need to be included in server side call - in such case server side code will be able to return data in necessary order


b) you can save|restore sorting state in|from cookie
        grid.loadSortingFromCookie(); … 5241999000