D'Arcy from Winnipeg
Solution Architecture, Business & Entrepreneurship, Microsoft, and Adoption

About to throw my grid views into the snowbank

Monday, February 27, 2006 8:55 AM

Ok, at first it was mildly annoying...but now its a raging hemhroid on the butt of my application.

I have these grid views...they have an update feature using a command button in the grid...you click edit, the cells turn to textboxes, you click Updated and the new data gets sent to the database. Unfortunately, nobody seems to be telling the gridview this, as it will still persist the OLD data! I've tried refreshing...nope...I've tried clicking edit/cancel...uh uh...for some reason, it just doesn't want to go back to teh database and get the new values. Am I missing something here? Shouldn't this be really REALLY easy to do?

I'm working with an object data source if that matters at all...any help is appreciated. And this is an ASP.NET 2.0 Grid View btw.




# re: About to throw my grid views into the snowbank

Ah yes, the classic issue with GridViews:

Unfortunately something is causing the GridVIew to rebind to the original Data source, overwriting the postback changes. If you manually call DataBind() be sure that your code isnt also resetting the Datasource (or possibly the DataSourceID as well) which could cause the GridView to rebind to the ORIGINAL data.

Hope that helps...
-E 2/27/2006 9:28 AM | Eric Newton

# re: About to throw my grid views into the snowbank

Eureka! Turns out that my anger towards the GridView and object data source was misplaced.

We're using the Gentle.NET framework, and by default its caching settings were set to bypass database queries and used cached data instead. I put an end to that pretty quick, and now the grids are things of beauty.


D 2/27/2006 12:16 PM | D'Arcy from Winnipeg

Post a comment