Export (0) Print
Expand All
Expand Minimize

FormView.EditItemTemplate Property

Gets or sets the custom content for an item in edit mode.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

[<BrowsableAttribute(false)>]
[<PersistenceModeAttribute(PersistenceMode.InnerProperty)>]
[<TemplateContainerAttribute(typeof(FormView), BindingDirection.TwoWay)>]
abstract EditItemTemplate : ITemplate with get, set
[<BrowsableAttribute(false)>]
[<PersistenceModeAttribute(PersistenceMode.InnerProperty)>]
[<TemplateContainerAttribute(typeof(FormView), BindingDirection.TwoWay)>]
override EditItemTemplate : ITemplate with get, set
<asp:FormView>
	<EditItemTemplate>ITemplate</EditItemTemplate>
</asp:FormView>

Property Value

Type: System.Web.UI.ITemplate
A System.Web.UI.ITemplate that contains the custom content for the data row when the FormView control is in edit mode. The default value is null, which indicates that this property is not set.

The FormView control renders a different template for the data row based on the current mode of the control (specified by the CurrentMode property). The following table shows which template is used for each mode.

Mode

Template rendered

Edit

EditItemTemplate

Insert

InsertItemTemplate

Read-only

ItemTemplate

Use the EditItemTemplate property to define your own user interface (UI) for the data row when the FormView control is in edit mode. The edit item template usually contains the input controls for the user to update the values of an existing record, as well as command buttons to update the record and to cancel the update operation.

To specify the custom template, first place <EditItemTemplate> tags between the opening and closing tags of the FormView control. You can then list the contents of the template between the opening and closing <EditItemTemplate> tags. By using a two-way binding expression, you can associate a field with an input control. This allows the FormView control to automatically display the original field value in the associated input control in edit mode. When a record is updated, the FormView control automatically extracts the updated field value from the associated input control. For more information on two-way binding expressions, see Binding to Databases. To create command buttons that perform the built-in cancel and update operations, add a command button control to the template with its CommandName property set to one of the values listed in the following table.

Command button type

CommandName value

Cancel

"Cancel"

Update

"Update"

You can control the appearance of the item template by using the EditRowStyle property.

The following example demonstrates how to define a custom template for a data row in edit mode.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft