I'm working on an application and we are using User Controls hosted in an ASP.Net 2.0 Web Part. Everything was working fine then suddenly nothing seemed to work right. The form view controls were either outright broken, or the we saving blank rows to the database. It took some investigating, but here is what I discovered:
1. You cannot have an Object Data Source running on MOSS and it have a parameter (insert, update or otherwise) with a type of 'object'. This appears to be the type assigned for GUIDs (database fields of type 'unique identifier'). When you do, as soon as I would bind the formview I would get a generic MOSS error page. You know the one, 'A web part is causing a problem....'
By changing the type on the parameter to 'string' everything started working. Of course that was only half the problem. Since making this change eliminated the MOSS error but I was still getting blank rows in the database.
2. The other thing I discovered. You cannot use the asp:table control in templates of the form view. When you do, the data fields are no longer bound to the datasource. The asp:table is bound. The controls of the form view are now children of the asp:table and not the form view. You could probably get around this by fully qualifying the controls for the parameters but why?
So, we changed the templates back to straight HTML tables and changed the parameter types to strings and voila! The app is working as it should.
Now keep in mind that outside off MOSS the app worked fine without changing the parameter types. The asp:tables were still an issue thou.
Weird no?
No comments:
Post a Comment