System.Web.UI.WebControls.FormView.InsertItemTemplate Property

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

Syntax

[System.ComponentModel.Browsable(false)]
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
[System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.FormView), System.ComponentModel.BindingDirection.TwoWay)]
[System.ComponentModel.DefaultValue(null)]
public virtual System.Web.UI.ITemplate InsertItemTemplate { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

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

Edit

FormView.EditItemTemplate

Insert

FormView.InsertItemTemplate

Read-only

FormView.ItemTemplate

Use the FormView.InsertItemTemplate property to define your own user interface (UI) for the data row when the System.Web.UI.WebControls.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 System.Web.UI.WebControls.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 System.Web.UI.WebControls.FormView control automatically extracts the field value from the associated input control. For more information on two-way binding expressions, see ASP.NET Data Binding. 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.

Cancel

"Cancel"

Insert

"Insert"

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

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0