Wednesday 5 March 2008

A simple reminder to all: MS AJAX update panel and DataSources interaction - FormView.Update not passing values to DataSource

My Brazillian colleague Andre Gallo was having issues today with one of our datasources not being updated from an ASP.NET formview (a modified Object Container DataSource, part of the Web Client Software Factory package). While the formview had all the values (clearly visible via FormView.FindControl("myControlName"), a call to FormView.Updateitem() was not setting the value on the Object Container Data Source (aka OCDS). I had a look and the problem was that the datasource was OUTSIDE the AJAX panel - and so was not being passed through to the server by the partial postback.

There were 2 possible resolutions to that one:
  1. To put the object container datasource into the same panel
  2. To use the Telerik controls RadAjaxManager which allows you to point to specific trigger and destination controls for the partial postback.

We resolved the issue with option 2.

1 comment:

Anonymous said...

I had the same problem, but wasn't using an UpdatePanel. I finally tracked down the real cause. There's a documented bug on MS-Connect (#93672) - the formview won't update a DataSource's values for controls that are embedded in a container control such as asp:Panel or asp:Table.

Implementing an ItemUpdating handler (a documented workaround on Connect) fixed the problem for me.

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=93672