Tuesday, October 17, 2006

Extending FormView with Enhanced Design Time Support

Over the last week I started new ASP.NET project. After reviewing the requirements, I decided it was time to try out the new ASP.NET 2.0 FormView, GridView and DataSource controls. I had used these controls basic capabilities many times before, but this project was going to require more sophisticated use than any of my previous projects.

This series of articles will be focused on the use, limitations and enhancement of the built in FormView class and the FormViewDesigner. Also of note are some minor bugs discovered in the standard implementation of FormViewDesigner.

So it was time to start build a UI to View, Insert, Update and Delete data from a complex database. I had implemented my data access layer using TypedDataSets. The ObjectDataSource could connect easily to these. I built a few GridViews. Finally it was time to build the Viewers and Editors for the data.

I added my first FormView to a new ASP.NET page. Hooked into an ObjectDataSource and bag, I had templates generated for Insert, Update and View. I went in and started fixing the layout and adding in all my custom controls and validators. I hit F5 and there was my editor up and running in 30 minutes.

Then I realized, I had 30+ more Entities in the database that needed these editor build. At least 80% of what I did to the template code was just adding table layout and div/span and CSS class names. 30 tables x 30 minutes per table. It starts to add up for what amounts to code the Designer should be able to build.

Now I know why .NET can be so disappointing out of the box to Web Designers. In our case FormView’s build-in designer is very weak on the template code generation phase. You get a layout that is naive. Something like:

Label: <asp:label id="" runat="" text='<%#Bind(">???")'></asp:Label>

or


Label: <asp:textbox id="" runat="" text='<%#Bind(">???")'></asp:TextBox>


I plan on presenting a 4 part series of articles describing my solution to this problem. Stay tuned.

0 Comments:

Post a Comment

<< Home