FormView.InsertItemTemplate Property

Note: This property is new in the .NET Framework version 2.0.

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

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

[TemplateContainerAttribute(typeof(FormView), BindingDirection::TwoWay)] 
virtual property ITemplate^ InsertItemTemplate {
	ITemplate^ get ();
	void set (ITemplate^ value);
/** @property */
public ITemplate get_InsertItemTemplate ()

/** @property */
public void set_InsertItemTemplate (ITemplate value)

public function get InsertItemTemplate () : ITemplate

public function set InsertItemTemplate (value : ITemplate)

Property Value

A System.Web.UI.ITemplate that contains the custom content for the data row when the FormView control is in insert 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.


Template rendered







Use the InsertItemTemplate property to define your own user interface (UI) for the data row when the FormView control is in insert mode. The insert item template usually contains the input controls for the user to enter the values for the new record, as well as command buttons to insert the record and to cancel the insert operation.

To specify the custom template, first place <InsertItemTemplate> 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 <InsertItemTemplate> tags. By using a two-way binding expression, you can associate a field with an input control. When a record is inserted, the FormView control automatically extracts the 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 insert 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





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

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

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

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions