I have a gridview that is populated on the Page_Load event if !PostBack is true.
The gridview has several column, each header template has a custom control that I'm using to sort the data in a more efficient way than what the ASP.NET gridview offers.
These custom controls have an OnSort event, I have tried defining them in the markup (was always null after postback) and hooking them up each time the page is loaded (now works).
Basically on a page postback, the ViewState for the custom controls in the gridview are being 'lost'. This is a problem as I have a Sort Direction field that toggles between Asc and Desc, and I rely heavily on the ViewState to remember the last value.
Does anyone know what I might be doing wrong here? Or how I could change my code to keep the ViewState.
Cheers