.Net ramblings
# Monday, 08 November 2004
Asp.Net DataGrid PageIndexChanged not working

i have an asp.net custom server control (deriving from a datagrid) and it has built in paging, sorting and databinding.  i ran into a weird problem, and thanks to Rick Strahl's post on http://west-wind.com/weblog/posts/211.aspx i was able to get it working.  Read that page first because there are many solutions posted for this weird error.

i'm using regular paging, and the next button works fine (all the time, for multiple pages), but if i click previous then a dud postback happens and the pageIndexChanged event doesn't fire.  i'm 100% sure that the eventhandler is hooked up, it just doesn't fire.  the solution in my case was to bind the datagrid in the control's PreRender method instead of in the OnInit method.  it just worked fine after doing this. 


Monday, 08 November 2004 18:33:01 (GMT Standard Time, UTC+00:00)  #    Comments [0]  Asp.Net