Geeks With Blogs
Bunch's Blog One day I'll have a catchy subtitle, one day

I ran into an issue using the DetailsView with and ObjectDataSource and paging. In this setup the DetailsView would populate data based off the user’s selection from a dropdown. The paging itself was not the issue that worked just fine.

The issue I had was that if the DetailsView displayed data with multiple pages and the user selected a page other than the first and then picked a different value from the dropdown that only had one page to display in the DetailsView it would default to the EmptyDataTemplate. I checked the various values to see if the data just was not being returned for the item with only one page but everything looked ok from that standpoint. The maximumRows and startRowIndex were correct and the latter changed to reflect that the new data had only one page worth of data.

My fix was to set the DetailsView PageIndex to 0 prior to the data retrieval. In my case I used the dropdown’s SelectedIndexChanged to set dvTest.PageIndex = 0. This changed the index back to 0 prior to the ObjectDataSource calling its methods to return the data.

Technorati Tags:
Posted on Tuesday, March 31, 2009 10:58 AM ASP.Net | Back to top


Comments on this post: DetailsView Blank with Single Record and Paging

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Bunch | Powered by: GeeksWithBlogs.net