Wednesday, November 19, 2008

RowUpdating event and UpdateRow method of a GridView not firing

We struck a bit of an odd problem today. We had an older ASP.NET 2.0 website we were migrating to ASP.NET 3.5 and one of the pages has a GridView on it. As we use Spring.NET and NHibernated Microsofts new objectdatasource approach for binding the GridView won't fly so we were using old school databinding. This meant we needed to be able to handle the RowUpdating event in order to persist our changes. The problem was that the RowUpdating event just wasn't firing.

Eventually we tracked it down to a weird interaction between Spring.NET and the GridView where if we wrapped the GridView in a spring:panel and suppressed dependency injection the event started firing. Of course the new and old values that are supposed to be available in that event handler were still null...

There is obviously a bug with the databinding in the GridView somewhere and it seems Microsoft is aware of the issue, however I wouldn't hold my breath for a fix to be forthcoming.

Personally I think the new objectdatasource model has some serious drawbacks and the fact that Microsoft haven't made the effort to ensure that custom databinding still works is a real shame to say the very least!

Labels: , ,

0 Comments:

Post a Comment

<< Home