Formview itemupdating event

If you now run your page, it will display the collection's first item.

By using the paging controls at the bottom of the Form View, you'll be able to page through your data.

However, the templates are still there: Open the Form View's Smart Tag and select Edit Templates; the Form View will switch to displaying its Item Template. The Item Template is used to display the data in read-only mode; to support that, drag a Label onto the template for each object property you want to display.

For this example, I want to display my Customer object's First Name and Last Name properties, so I add two Labels and some text to identify the information to the template.

In this event, you'll need to retrieve the object that corresponds to the data being displayed and update its properties from the data in the Form View.

When the user clicks on the Edit Item Template's Save button, the Item Updating event will fire.You won't get automatic generation of the Data View's templates and you'll have to write a little code, but from the user's point of view, everything works as if your Data View was tied to a Data Source.So here's how to use a Form View to display—and let the user update -- any collection of objects.To retrieve the values currently displayed in the Form View, use the event's e parameter.Its New Values property, when passed a property name, returns the value from the corresponding control on the Form View.

Search for formview itemupdating event:

formview itemupdating event-76formview itemupdating event-15formview itemupdating event-42

After dropping the Form View onto your page, add, in the Page Load event, the code to build your collection of objects and set the Data View's Data Source property to that collection.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “formview itemupdating event”