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

  • DotNetNuke Modules – Creating Base ModulesDotNetNuke Modules – Creating Base Modules Now that we have DotNetNuke installed into Visual Studio we can go ahead and create our first modules. Actually, creating the modules is pretty simple. But it is even easier to do it wrong, which...
  • Sharing ObjectDataSource From CodebehindSharing ObjectDataSource From Codebehind I ran into an interesting “problem” last week that wasn’t all that hard to figure out once I broke out the debugger.  But I thought it would be useful to share the results to save others th...
  • Editing in a GridView without switching to Edit mode.Editing in a GridView without switching to Edit mode. I just saw a question about this yesterday and realized that while I know how to do this, not everyone does.  So, here we go... Here's the problem.  You want to be able to edit all of the rows i...
  • GridView and Updating A Row ManuallyGridView and Updating A Row Manually A couple of days ago I mentioned a project that I’ve been working on that is a bit out of the ordinary as far as GridViews go.  One of the issues I’ve had is that the edit template doesn’t ...
  • “I don’t exactly have random $$$ hanging about.”“I don’t exactly have random $$$ hanging about.” I hear this statement a lot, or one like it, from various walks of life.  For example, I hear it from clients.  I hear it from people who want a new car.  But I’d like to address th...
  • Art Gladney

    Do you have a sample of the FormView Edit and Add that you can e-mail me. It looks like a great approach.

    Art

  • Dave

    Sorry no samples. But, if you follow along with the video, you’ll have a sample.