Export (0) Print
Expand All

TemplateField.InsertItemTemplate Property

Gets or sets the template for displaying an item in insert mode in a TemplateField object.

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

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

Property Value

Type: System.Web.UI.ITemplate
A System.Web.UI.ITemplate-implemented object that contains the template for displaying an item in insert mode in a TemplateField. The default is a null reference (Nothing in Visual Basic), which indicates that this property is not set.

Use the InsertItemTemplate property to specify the custom content displayed for an item in insert mode in a TemplateField object. Define the content by creating a template that specifies how the item in insert mode is rendered.

To specify a template, first place opening and closing <InsertItemTemplate> tags between the opening and closing tags of the <TemplateField> element. Next, add the custom content between the opening and closing <InsertItemTemplate> tags. The content can be as simple as plain text or more complex (embedding other controls in the template, for example).

To programmatically access a control defined in a template, first determine which TableCell object in the data-bound control contains the control. Next, use the Controls collection of the TableCell object to access the control. You can also use the FindControl method of the TableCell object to find the control, if the control has an ID property specified.

NoteNote

Not all data-bound controls support this template This template is supported only by data-bound controls that allow you to insert a record, such as the DetailsView control.

The following code example demonstrates how to use the InsertItemTemplate property to create a custom template for an item in insert mode in a TemplateField field row in a DetailsView control. The template displays a DropDownList control that allows the user to select a value from a predefined list.

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