What is the best way to implement “Copy to new” functionality with FormView control and content templates

I have a FormView control in an ASP.NET page. I use the InsertItemTemplate and EditItemTemplate to provide data manipulation functionality, and it is working very well. I would like to allow the user to "Copy to new" from an existing item. In other words, I want the user to be able to display an item as if they are going to edit it, then, if they click a "Copy to new" button, it will load the information from that item into an "Insert" form so they could just change the bits of data that they want, and insert the new item.

The data objects we are dealing with are fairly large so, providing this functionality will save the user a lot of data entry misery.

I have experimented with copying the existing EditItemTemplate controls in the Copy button's click event, storing them, and writing them to the new InsertItemTemplate controls, once the form is reloaded (in the Page_PreRender event). But this is pretty ugly stuff. There has to be a better/simpler way.

Does anyone have any suggestions?

Thanks very much for whatever advice you can give.

Answers


Well, why not just leave it in edit view, have Copy to new set a flag, then handle the ItemEditing event, and if in copy to new mode, then you insert a new record instead of proceeding with the update. That might save you a lot of work.

HTH.


Need Your Help

Showing ProgressDialog while a Service is being started

android service progressdialog

I'm having serious problems when showing a ProgressDialog while a service is getting ready... The service takes time to get ready as it's a bit heavy, so I want to show the ProgressDialog meanwhile...

Source Control Layout

.net version-control file

I develop a variety of applications and have 3-4 miscellaneous libraries that I reuse across these apps (one for math, one for database functions etc.).

What is the difference between the '' property and the '@each' property in ember.js?

ember.js

I've noticed that the enumerable mixin has computed properties that depends on the '[]' property, while ember arrays also have the '@each' property.