FormView Edit and Add

The FormView generally makes editing a record at a time pretty easy.  However, one of the biggest problems I’ve seen with this control is that there is no way of telling the FormView to use the same template for both Add and Update.  My experience has been that most of the time, Add and Update look exactly the same, or enough the same that you could use one template and hide the inappropriate controls in the template.

One of my first attempts at fixing this problem was to use a WebUserControl.  However, I quickly discovered that you can’t databind a WebUserControl.  That was in Visual Studio 2005.  I’m not sure if it’s changed in 2008, but I assume it hasn’t.

I finally discovered a great way of using the Edit template for both the Add and Edit operations.  Simply by making use of the three tiered archietecture, you can overcome this limitation of the FormView control.

Related Post

2 Responses to “FormView Edit and Add”

Leave a Reply

Comment Policy:

  • You must verify your comment by responding to the automated email that is sent to your email address. Unverified comments will never show.Leave a good comment that adds to the conversation and I'll leave your link in.
  • Leave me pure spam and I'll delete it.
  • Leave a general comment and I'll remove the link but keep the comment.

Notify me of followup comments via e-mail

Bear