Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
5752 lines (5073 sloc) 420 KB
<Type Name="FormView" FullName="System.Web.UI.WebControls.FormView">
<TypeSignature Language="C#" Value="public class FormView : System.Web.UI.WebControls.CompositeDataBoundControl, System.Web.UI.IDataItemContainer, System.Web.UI.IPostBackEventHandler, System.Web.UI.WebControls.IDataBoundItemControl, System.Web.UI.WebControls.IPostBackContainer" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit FormView extends System.Web.UI.WebControls.CompositeDataBoundControl implements class System.Web.UI.IDataItemContainer, class System.Web.UI.INamingContainer, class System.Web.UI.IPostBackEventHandler, class System.Web.UI.WebControls.IDataBoundControl, class System.Web.UI.WebControls.IDataBoundItemControl, class System.Web.UI.WebControls.IPostBackContainer" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.WebControls.FormView" />
<TypeSignature Language="VB.NET" Value="Public Class FormView&#xA;Inherits CompositeDataBoundControl&#xA;Implements IDataBoundItemControl, IDataItemContainer, IPostBackContainer, IPostBackEventHandler" />
<TypeSignature Language="C++ CLI" Value="public ref class FormView : System::Web::UI::WebControls::CompositeDataBoundControl, System::Web::UI::IDataItemContainer, System::Web::UI::IPostBackEventHandler, System::Web::UI::WebControls::IDataBoundItemControl, System::Web::UI::WebControls::IPostBackContainer" />
<TypeSignature Language="F#" Value="type FormView = class&#xA; inherit CompositeDataBoundControl&#xA; interface IDataItemContainer&#xA; interface INamingContainer&#xA; interface IPostBackEventHandler&#xA; interface IPostBackContainer&#xA; interface IDataBoundItemControl&#xA; interface IDataBoundControl" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Web.UI.WebControls.CompositeDataBoundControl</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Web.UI.IDataItemContainer</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Web.UI.INamingContainer</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Web.UI.IPostBackEventHandler</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Web.UI.WebControls.IDataBoundControl</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Web.UI.WebControls.IDataBoundItemControl</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Web.UI.WebControls.IPostBackContainer</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultEvent("PageIndexChanging")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.ComponentModel.Designer("System.Web.UI.Design.WebControls.FormViewDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.ControlValueProperty("SelectedValue")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Web.UI.DataKeyProperty("DataKey")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.SupportsEventValidation</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5">
<AttributeName>System.ComponentModel.Designer("System.Web.UI.Design.WebControls.FormViewDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Displays the values of a single record from a data source using user-defined templates. The <see cref="T:System.Web.UI.WebControls.FormView" /> control allows you to edit, delete, and insert records.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
In this topic:
- [Introduction](#introduction)
- [Templates](#templates)
- [Binding to Data](#binding_to_data)
- [Data Operations](#data_operations)
- [Customizing the User Interface](#customizing_the_user_interface)
- [Events](#events)
- [Accessibility](#accessibility)
- [Applying CSS Styles](#applying_styles)
- [Declarative Syntax](#declarative_syntax)
<a name="introduction"></a>
## Introduction
The <xref:System.Web.UI.WebControls.FormView> control is used to display a single record from a data source. It is similar to the <xref:System.Web.UI.WebControls.DetailsView> control, except it displays user-defined templates instead of row fields. Creating your own templates gives you greater flexibility in controlling how the data is displayed. The <xref:System.Web.UI.WebControls.FormView> control supports the following features:
- Binding to data source controls, such as <xref:System.Web.UI.WebControls.SqlDataSource> and <xref:System.Web.UI.WebControls.ObjectDataSource>.
- Built-in inserting capabilities.
- Built-in updating and deleting capabilities.
- Built-in paging capabilities.
- Programmatic access to the <xref:System.Web.UI.WebControls.FormView> object model to dynamically set properties, handle events, and so on.
- Customizable appearance through user-defined templates, themes, and styles.
<a name="templates"></a>
## Templates
For the <xref:System.Web.UI.WebControls.FormView> control to display content, you need to create templates for the different parts of the control. Most templates are optional; however, you must create a template for the mode in which the control is configured. For example, a <xref:System.Web.UI.WebControls.FormView> control that supports inserting records must have an insert item template defined. The following table lists the different templates that you can create.
|Template type|Description|
|-------------------|-----------------|
|<xref:System.Web.UI.WebControls.FormView.EditItemTemplate%2A>|Defines the content for the data row when the <xref:System.Web.UI.WebControls.FormView> control is in edit mode. This template usually contains input controls and command buttons with which the user can edit an existing record.|
|<xref:System.Web.UI.WebControls.FormView.EmptyDataTemplate%2A>|Defines the content for the empty data row displayed when the <xref:System.Web.UI.WebControls.FormView> control is bound to a data source that does not contain any records. This template usually contains content to alert the user that the data source does not contain any records.|
|<xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A>|Defines the content for the footer row. This template usually contains any additional content you would like to display in the footer row. **Note:** As an alternative, you can simply specify text to display in the footer row by setting the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> property.|
|<xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A>|Defines the content for the header row. This template usually contains any additional content you would like to display in the header row. **Note:** As an alternative, you can simply specify text to display in the header row by setting the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> property.|
|<xref:System.Web.UI.WebControls.FormView.ItemTemplate%2A>|Defines the content for the data row when the <xref:System.Web.UI.WebControls.FormView> control is in read-only mode. This template usually contains content to display the values of an existing record.|
|<xref:System.Web.UI.WebControls.FormView.InsertItemTemplate%2A>|Defines the content for the data row when the <xref:System.Web.UI.WebControls.FormView> control is in insert mode. This template usually contains input controls and command buttons with which the user can add a new record.|
|<xref:System.Web.UI.WebControls.FormView.PagerTemplate%2A>|Defines the content for the pager row displayed when the paging feature is enabled (when the <xref:System.Web.UI.WebControls.FormView.AllowPaging%2A> property is set to `true`). This template usually contains controls with which the user can navigate to another record. **Note:** The <xref:System.Web.UI.WebControls.FormView> control has a built-in pager row user interface (UI). You need to create a pager template only if you want to create your own custom pager row.|
To display the value of a field in an item template, use a data binding expression. For more information on data binding expressions, see [Data-Binding Expression Syntax](https://msdn.microsoft.com/library/676beb1d-ddfa-4153-bba8-3c86dcb7ceca).
Input controls in the edit item template and insert item template can be bound to the fields of a data source by using a two-way binding expression. This allows the <xref:System.Web.UI.WebControls.FormView> control to automatically extract the values of the input control for an update or insert operation. Two-way binding expressions also allow input controls in an edit item template to automatically display the original field values. For more information on two-way binding expressions, see [Binding to Databases](https://msdn.microsoft.com/library/ab7b2846-975b-4057-a948-45527497c742).
<a name="binding_to_data"></a>
## Binding to Data
The <xref:System.Web.UI.WebControls.FormView> control can be bound to a data source control (such as <xref:System.Web.UI.WebControls.SqlDataSource>, <xref:System.Web.UI.WebControls.ObjectDataSource>, or <xref:System.Web.UI.WebControls.AccessDataSource>) or to any data source collection that implements the <xref:System.Collections.IEnumerable?displayProperty=nameWithType> interface, such as <xref:System.Data.DataView?displayProperty=nameWithType>, <xref:System.Collections.ArrayList?displayProperty=nameWithType>, <xref:System.Collections.Generic.List%601?displayProperty=nameWithType>, or other collection types. Use one of the following methods to bind the <xref:System.Web.UI.WebControls.FormView> control to the appropriate data source type:
- To bind to a data source control, set the <xref:System.Web.UI.WebControls.DataBoundControl.DataSourceID%2A> property of the <xref:System.Web.UI.WebControls.FormView> control to the <xref:System.Web.UI.Control.ID%2A> value of the data source control. The <xref:System.Web.UI.WebControls.FormView> control automatically binds to the specified data source control and can take advantage of the data source control's capabilities to perform inserting, updating, deleting, and paging functionality. This is the preferred method to bind to data.
- To bind to a data source that implements the <xref:System.Collections.IEnumerable?displayProperty=nameWithType> interface, programmatically set the <xref:System.Web.UI.WebControls.BaseDataBoundControl.DataSource%2A> property of the <xref:System.Web.UI.WebControls.FormView> control to the data source and then call the <xref:System.Web.UI.WebControls.BaseDataBoundControl.DataBind%2A> method. When using this method, the <xref:System.Web.UI.WebControls.FormView> control does not provide built-in inserting, updating, deleting, and paging functionality. You need to provide this functionality by using the appropriate event.
For more information on data binding, see [ASP.NET Data Access Content Map](https://msdn.microsoft.com/library/f9219396-a0fa-481f-894d-e3d9c67d64f2).
> [!NOTE]
> This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. Whenever possible, it is strongly recommended that values are HTML-encoded before they are displayed in this control. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input. For more information, see [Introduction to the Validation Controls](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.0/2e4hd649(v=vs.85)).
<a name="data_operations"></a>
## Data Operations
The <xref:System.Web.UI.WebControls.FormView> control provides many built-in capabilities that allow the user to update, delete, insert, and page through items in the control. When the <xref:System.Web.UI.WebControls.FormView> control is bound to a data source control, the <xref:System.Web.UI.WebControls.FormView> control can take advantage of the data source control's capabilities and provide automatic updating, deleting, inserting, and paging functionality.
> [!NOTE]
> The <xref:System.Web.UI.WebControls.FormView> control can provide support for update, delete, insert, and paging operations with other types of data sources; however, you must provide an appropriate event handler with the implementation for these operations.
Because the <xref:System.Web.UI.WebControls.FormView> control uses templates, it does not provide a way to automatically generate command buttons to perform updating, deleting, or inserting operations. You must manually include these command buttons in the appropriate template. The <xref:System.Web.UI.WebControls.FormView> control recognizes certain buttons that have their `CommandName` properties set to specific values. The following table lists the command buttons that the <xref:System.Web.UI.WebControls.FormView> control recognizes.
|Button|CommandName value|Description|
|------------|-----------------------|-----------------|
|Cancel|"Cancel"|Used in updating or inserting operations to cancel the operation and to discard the values entered by the user. The <xref:System.Web.UI.WebControls.FormView> control then returns to the mode specified by the <xref:System.Web.UI.WebControls.FormView.DefaultMode%2A> property.|
|Delete|"Delete"|Used in deleting operations to delete the displayed record from the data source. Raises the <xref:System.Web.UI.WebControls.FormView.ItemDeleting> and <xref:System.Web.UI.WebControls.FormView.ItemDeleted> events.|
|Edit|"Edit"|Used in updating operations to put the <xref:System.Web.UI.WebControls.FormView> control in edit mode. The content specified in the <xref:System.Web.UI.WebControls.FormView.EditItemTemplate%2A> property is displayed for the data row.|
|Insert|"Insert"|Used in inserting operations to attempt to insert a new record in the data source using the values provided by the user. Raises the <xref:System.Web.UI.WebControls.FormView.ItemInserting> and <xref:System.Web.UI.WebControls.FormView.ItemInserted> events.|
|New|"New"|Used in inserting operations to put the <xref:System.Web.UI.WebControls.FormView> control in insert mode. The content specified in the <xref:System.Web.UI.WebControls.FormView.InsertItemTemplate%2A> property is displayed for the data row.|
|Page|"Page"|Used in paging operations to represent a button in the pager row that performs paging. To specify the paging operation, set the `CommandArgument` property of the button to "Next", "Prev", "First", "Last", or the index of the page to which to navigate. Raises the <xref:System.Web.UI.WebControls.FormView.PageIndexChanging> and <xref:System.Web.UI.WebControls.FormView.PageIndexChanged> events. **Note:** This type of button is typically used only in the pager template.|
|Update|"Update"|Used in updating operations to attempt to update the displayed record in the data source with the values provided by the user. Raises the <xref:System.Web.UI.WebControls.FormView.ItemUpdating> and <xref:System.Web.UI.WebControls.FormView.ItemUpdated> events.|
Unlike the Delete button (which deletes the displayed record immediately), when the Edit or New button is clicked, the <xref:System.Web.UI.WebControls.FormView> control goes into edit or insert mode, respectively. In edit mode, the content contained in the <xref:System.Web.UI.WebControls.FormView.EditItemTemplate%2A> property is displayed for the current data item. Typically, the edit item template is defined such that the Edit button is replaced with an Update and a Cancel button. Input controls that are appropriate for the field's data type (such as a <xref:System.Web.UI.WebControls.TextBox> or a <xref:System.Web.UI.WebControls.CheckBox> control) are also usually displayed with a field's value for the user to modify. Clicking the Update button updates the record in the data source, while clicking the Cancel button abandons any changes.
Likewise, the content contained in the <xref:System.Web.UI.WebControls.FormView.InsertItemTemplate%2A> property is displayed for the data item when the control is in insert mode. The insert item template is typically defined such that the New button is replaced with an Insert and a Cancel button, and empty input controls are displayed for the user to enter the values for the new record. Clicking the Insert button inserts the record in the data source, while clicking the Cancel button abandons any changes.
The <xref:System.Web.UI.WebControls.FormView> control provides a paging feature, which allows the user to navigate to other records in the data source. When enabled, a pager row is displayed in the <xref:System.Web.UI.WebControls.FormView> control that contains the page navigation controls. To enable paging, set the <xref:System.Web.UI.WebControls.FormView.AllowPaging%2A> property to `true`. You can customize the pager row by setting the properties of objects contained in the <xref:System.Web.UI.WebControls.FormView.PagerStyle%2A> and the <xref:System.Web.UI.WebControls.FormView.PagerSettings%2A> property. Instead of using the built-in pager row UI, you can create your own UI by using the <xref:System.Web.UI.WebControls.FormView.PagerTemplate%2A> property.
<a name="customizing_the_user_interface"></a>
## Customizing the User Interface
You can customize the appearance of the <xref:System.Web.UI.WebControls.FormView> control by setting the style properties for the different parts of the control. The following table lists the different style properties.
|Style property|Description|
|--------------------|-----------------|
|<xref:System.Web.UI.WebControls.FormView.EditRowStyle%2A>|The style settings for the data row when the <xref:System.Web.UI.WebControls.FormView> control is in edit mode.|
|<xref:System.Web.UI.WebControls.FormView.EmptyDataRowStyle%2A>|The style settings for the empty data row displayed in the <xref:System.Web.UI.WebControls.FormView> control when the data source does not contain any records.|
|<xref:System.Web.UI.WebControls.FormView.FooterStyle%2A>|The style settings for the footer row of the <xref:System.Web.UI.WebControls.FormView> control.|
|<xref:System.Web.UI.WebControls.FormView.HeaderStyle%2A>|The style settings for the header row of the <xref:System.Web.UI.WebControls.FormView> control.|
|<xref:System.Web.UI.WebControls.FormView.InsertRowStyle%2A>|The style settings for the data row when the <xref:System.Web.UI.WebControls.FormView> control is in insert mode.|
|<xref:System.Web.UI.WebControls.FormView.PagerStyle%2A>|The style settings for the pager row displayed in the <xref:System.Web.UI.WebControls.FormView> control when the paging feature is enabled.|
|<xref:System.Web.UI.WebControls.FormView.RowStyle%2A>|The style settings for the data row when the <xref:System.Web.UI.WebControls.FormView> control is in read-only mode.|
<a name="events"></a>
## Events
The <xref:System.Web.UI.WebControls.FormView> control provides several events that you can program against. This allows you to run a custom routine whenever an event occurs. The following table lists the events supported by the <xref:System.Web.UI.WebControls.FormView> control.
|Event|Description|
|-----------|-----------------|
|<xref:System.Web.UI.WebControls.FormView.ItemCommand>|Occurs when a button within a <xref:System.Web.UI.WebControls.FormView> control is clicked. This event is often used to perform a task when a button is clicked in the control.|
|<xref:System.Web.UI.WebControls.FormView.ItemCreated>|Occurs after all <xref:System.Web.UI.WebControls.FormViewRow> objects are created in the <xref:System.Web.UI.WebControls.FormView> control. This event is often used to modify the values of a record before it is displayed.|
|<xref:System.Web.UI.WebControls.FormView.ItemDeleted>|Occurs when a Delete button (a button with its `CommandName` property set to "Delete") is clicked, but after the <xref:System.Web.UI.WebControls.FormView> control deletes the record from the data source. This event is often used to check the results of the delete operation.|
|<xref:System.Web.UI.WebControls.FormView.ItemDeleting>|Occurs when a Delete button is clicked, but before the <xref:System.Web.UI.WebControls.FormView> control deletes the record from the data source. This event is often used to cancel the delete operation.|
|<xref:System.Web.UI.WebControls.FormView.ItemInserted>|Occurs when an Insert button (a button with its `CommandName` property set to "Insert") is clicked, but after the <xref:System.Web.UI.WebControls.FormView> control inserts the record. This event is often used to check the results of the insert operation.|
|<xref:System.Web.UI.WebControls.FormView.ItemInserting>|Occurs when an Insert button is clicked, but before the <xref:System.Web.UI.WebControls.FormView> control inserts the record. This event is often used to cancel the insert operation.|
|<xref:System.Web.UI.WebControls.FormView.ItemUpdated>|Occurs when an Update button (a button with its `CommandName` property set to "Update") is clicked, but after the <xref:System.Web.UI.WebControls.FormView> control updates the row. This event is often used to check the results of the update operation.|
|<xref:System.Web.UI.WebControls.FormView.ItemUpdating>|Occurs when an Update button is clicked, but before the <xref:System.Web.UI.WebControls.FormView> control updates the record. This event is often used to cancel the update operation.|
|<xref:System.Web.UI.WebControls.FormView.ModeChanged>|Occurs after the <xref:System.Web.UI.WebControls.FormView> control changes modes (to edit, insert, or read-only mode). This event is often used to perform a task when the <xref:System.Web.UI.WebControls.FormView> control changes modes.|
|<xref:System.Web.UI.WebControls.FormView.ModeChanging>|Occurs before the <xref:System.Web.UI.WebControls.FormView> control changes modes (to edit, insert, or read-only mode). This event is often used to cancel a mode change.|
|<xref:System.Web.UI.WebControls.FormView.PageIndexChanged>|Occurs when one of the pager buttons is clicked, but after the <xref:System.Web.UI.WebControls.FormView> control handles the paging operation. This event is commonly used when you need to perform a task after the user navigates to a different record in the control.|
|<xref:System.Web.UI.WebControls.FormView.PageIndexChanging>|Occurs when one of the pager buttons is clicked, but before the <xref:System.Web.UI.WebControls.FormView> control handles the paging operation. This event is often used to cancel the paging operation.|
<a name="accessibility"></a>
## Accessibility
For information about how to configure this control so that it generates markup that conforms to accessibility standards, see [Accessibility in Visual Studio and ASP.NET](https://msdn.microsoft.com/library/7e3ce9c4-6b7d-4fb1-94b5-72cf2a44fe13) and [ASP.NET Controls and Accessibility](https://msdn.microsoft.com/library/847a37e3-ce20-41da-b0d3-7dfb0fdae9a0).
<a name="applying_styles"></a>
## Applying CSS Styles
The <xref:System.Web.UI.WebControls.FormView> control lets you specify CSS style rules in markup. If you use templates to customize the appearance of the <xref:System.Web.UI.WebControls.FormView> control, you can specify CSS styles in the markup in the templates. In that case, no extra outer table is required. You can prevent the table from being rendered by setting the <xref:System.Web.UI.WebControls.FormView.RenderOuterTable%2A> property to `false`.
<a name="declarative_syntax"></a>
## Declarative Syntax
```
<asp:FormView
    AccessKey="string"
    AllowPaging="True|False"
    BackColor="color name|#dddddd"
    BackImageUrl="uri"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
Inset|Outset"
    BorderWidth="size"
    Caption="string"
    CaptionAlign="NotSet|Top|Bottom|Left|Right"
    CellPadding="integer"
    CellSpacing="integer"
    CssClass="string"
    DataKeyNames="string"
    DataMember="string"
    DataSource="string"
    DataSourceID="string"
    DefaultMode="ReadOnly|Edit|Insert"
    EmptyDataText="string"
    Enabled="True|False"
    EnableTheming="True|False"
    EnableViewState="True|False"
    Font-Bold="True|False"
    Font-Italic="True|False"
    Font-Names="string"
    Font-Overline="True|False"
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
Large|X-Large|XX-Large"
    Font-Strikeout="True|False"
    Font-Underline="True|False"
    FooterText="string"
    ForeColor="color name|#dddddd"
    GridLines="None|Horizontal|Vertical|Both"
    HeaderText="string"
    Height="size"
    HorizontalAlign="NotSet|Left|Center|Right|Justify"
    ID="string"
    OnDataBinding="DataBinding event handler"
    OnDataBound="DataBound event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnItemCommand="ItemCommand event handler"
    OnItemCreated="ItemCreated event handler"
    OnItemDeleted="ItemDeleted event handler"
    OnItemDeleting="ItemDeleting event handler"
    OnItemInserted="ItemInserted event handler"
    OnItemInserting="ItemInserting event handler"
    OnItemUpdated="ItemUpdated event handler"
    OnItemUpdating="ItemUpdating event handler"
    OnLoad="Load event handler"
    OnModeChanged="ModeChanged event handler"
    OnModeChanging="ModeChanging event handler"
    OnPageIndexChanged="PageIndexChanged event handler"
    OnPageIndexChanging="PageIndexChanging event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    PageIndex="integer"
    PagerSettings-FirstPageImageUrl="uri"
    PagerSettings-FirstPageText="string"
    PagerSettings-LastPageImageUrl="uri"
    PagerSettings-LastPageText="string"
    PagerSettings-Mode="NextPrevious|Numeric|NextPreviousFirstLast|
NumericFirstLast"
    PagerSettings-NextPageImageUrl="uri"
    PagerSettings-NextPageText="string"
    PagerSettings-PageButtonCount="integer"
    PagerSettings-Position="Bottom|Top|TopAndBottom"
    PagerSettings-PreviousPageImageUrl="uri"
    PagerSettings-PreviousPageText="string"
    PagerSettings-Visible="True|False"
    RenderTable="True|False"
    runat="server"
    SkinID="string"
    Style="string"
    TabIndex="integer"
    ToolTip="string"
    Visible="True|False"
    Width="size"
>
        <EditItemTemplate>
<!-- child controls -->
        </EditItemTemplate>
        <EditRowStyle />
        <EmptyDataRowStyle />
        <EmptyDataTemplate>
<!-- child controls -->
        </EmptyDataTemplate>
        <FooterStyle />
        <FooterTemplate>
<!-- child controls -->
        </FooterTemplate>
        <HeaderStyle />
        <HeaderTemplate>
<!-- child controls -->
        </HeaderTemplate>
        <InsertItemTemplate>
<!-- child controls -->
        </InsertItemTemplate>
        <InsertRowStyle />
        <ItemTemplate>
<!-- child controls -->
        </ItemTemplate>
        <PagerSettings
            FirstPageImageUrl="uri"
            FirstPageText="string"
            LastPageImageUrl="uri"
            LastPageText="string"
            Mode="NextPrevious|Numeric|NextPreviousFirstLast|
NumericFirstLast"
            NextPageImageUrl="uri"
            NextPageText="string"
            OnPropertyChanged="PropertyChanged event handler"
            PageButtonCount="integer"
            Position="Bottom|Top|TopAndBottom"
            PreviousPageImageUrl="uri"
            PreviousPageText="string"
            Visible="True|False"
        />
        <PagerStyle />
        <PagerTemplate>
<!-- child controls -->
        </PagerTemplate>
        <RowStyle />
</asp:FormView>
```
## Examples
The following example demonstrates how to use a <xref:System.Web.UI.WebControls.FormView> control to display the values from a <xref:System.Web.UI.WebControls.SqlDataSource> control.
[!code-aspx-csharp[FormViewSimple#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewSimple/CS/formviewsimplecs.aspx#1)]
[!code-aspx-vb[FormViewSimple#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewSimple/VB/formviewsimplevb.aspx#1)]
The following example demonstrates how to use a <xref:System.Web.UI.WebControls.FormView> control to edit existing records.
> [!IMPORTANT]
> The control in this example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see [Script Exploits Overview](https://msdn.microsoft.com/library/772c7312-211a-4eb3-8d6e-eec0aa1dcc07).
[!code-aspx-csharp[FormView#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormView/CS/formvieweditcs.aspx#1)]
[!code-aspx-vb[FormView#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormView/VB/formvieweditvb.aspx#1)]
The following example demonstrates how to use a <xref:System.Web.UI.WebControls.FormView> control to insert new records.
> [!IMPORTANT]
> The control in this example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see [Script Exploits Overview](https://msdn.microsoft.com/library/772c7312-211a-4eb3-8d6e-eec0aa1dcc07).
[!code-aspx-csharp[FormViewInsertItemTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewInsertItemTemplate/CS/formviewinsertitemtemplatecs.aspx#1)]
[!code-aspx-vb[FormViewInsertItemTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewInsertItemTemplate/VB/formviewinsertitemtemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.DetailsView" />
<altmember cref="T:System.Web.UI.WebControls.GridView" />
<altmember cref="T:System.Web.UI.WebControls.FormViewRow" />
<altmember cref="T:System.Web.UI.WebControls.FormViewMode" />
<altmember cref="T:System.Web.UI.WebControls.AccessDataSource" />
<altmember cref="T:System.Web.UI.WebControls.SqlDataSource" />
<altmember cref="T:System.Web.UI.WebControls.ObjectDataSource" />
<altmember cref="P:System.Web.UI.WebControls.FormView.AllowPaging" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CurrentMode" />
<altmember cref="P:System.Web.UI.WebControls.FormView.DataKeyNames" />
<altmember cref="P:System.Web.UI.WebControls.FormView.DefaultMode" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerSettings" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.RowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.ItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerTemplate" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemCreated" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemCommand" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemDeleted" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemDeleting" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemInserted" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemInserting" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemUpdated" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemUpdating" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ModeChanged" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ModeChanging" />
<altmember cref="E:System.Web.UI.WebControls.FormView.PageIndexChanged" />
<altmember cref="E:System.Web.UI.WebControls.FormView.PageIndexChanging" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public FormView ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; FormView();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.FormView" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this constructor to initialize a new instance of the <xref:System.Web.UI.WebControls.FormView> class. To dynamically add a <xref:System.Web.UI.WebControls.FormView> control to a page, create a new <xref:System.Web.UI.WebControls.FormView> object, set its properties, and then add it to the <xref:System.Web.UI.Control.Controls%2A?displayProperty=nameWithType> collection of a container control, such as <xref:System.Web.UI.WebControls.PlaceHolder>.
## Examples
The following example demonstrates how to dynamically add a <xref:System.Web.UI.WebControls.FormView> control to a page.
[!code-aspx-csharp[FormViewCtor#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewCtor/CS/formviewctorcs.aspx#1)]
[!code-aspx-vb[FormViewCtor#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewCtor/VB/formviewctorvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.Control.Controls" />
<altmember cref="T:System.Web.UI.WebControls.PlaceHolder" />
</Docs>
</Member>
<Member MemberName="AllowPaging">
<MemberSignature Language="C#" Value="public virtual bool AllowPaging { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool AllowPaging" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.AllowPaging" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property AllowPaging As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property bool AllowPaging { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.AllowPaging : bool with get, set" Usage="System.Web.UI.WebControls.FormView.AllowPaging" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the paging feature is enabled.</summary>
<value>
<see langword="true" /> to enable the paging feature; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormView> control has built-in paging capabilities, which allow a user to navigate to a different record in the data source. The paging feature can be used with any data source object that supports the <xref:System.Collections.ICollection?displayProperty=nameWithType> interface or a data source that supports paging capability.
To enable the paging feature, set the <xref:System.Web.UI.WebControls.FormView.AllowPaging%2A> property to `true`. You can determine the total number of items in the underlying data source by using the <xref:System.Web.UI.WebControls.FormView.PageCount%2A> property. To determine the index of the currently displayed item, use the <xref:System.Web.UI.WebControls.FormView.PageIndex%2A> property.
When paging is enabled, an additional row called the pager row is automatically displayed in the <xref:System.Web.UI.WebControls.FormView> control. The pager row contains the page navigation controls and can be displayed at the top, bottom, or both the top and bottom of the control. The pager row has four built-in pager display modes. The following table describes the four modes.
|Mode|Description|
|----------|-----------------|
|`PagerButton.NextPrevious`|A set of pagination controls consisting of previous and next buttons.|
|`PagerButton.NextPreviousFirstLast`|A set of pagination controls consisting of previous, next, first, and last buttons.|
|`PagerButton.Numeric`|A set of pagination controls consisting of numbered link buttons to access pages directly. This is the default mode.|
|`PagerButton.NumericFirstLast`|A set of pagination controls consisting of numbered and first and last link buttons.|
> [!NOTE]
> The <xref:System.Web.UI.WebControls.FormView> control automatically hides the pager row when the data source contains fewer than two records.
You can control the settings of the pager row (such as the pager display mode, the number of page links to display at a time, and the pager control's text label) by using the <xref:System.Web.UI.WebControls.FormView.PagerSettings%2A> property. To control the appearance of the pager row (including its background color and font color), use the <xref:System.Web.UI.WebControls.FormView.PagerStyle%2A> property. The <xref:System.Web.UI.WebControls.FormView> control also allows you to define a custom template for the pager row. For more information on creating a custom pager row template, see <xref:System.Web.UI.WebControls.FormView.PagerTemplate%2A>.
The <xref:System.Web.UI.WebControls.FormView> control provides several events that you can use to perform a custom action when paging occurs. The following table lists the available events.
|Event|Description|
|-----------|-----------------|
|<xref:System.Web.UI.WebControls.FormView.PageIndexChanged>|Occurs when one of the pager buttons is clicked, but after the <xref:System.Web.UI.WebControls.FormView> control handles the paging operation. This event is commonly used when you need to perform a task after the user navigates to a different record in the control.|
|<xref:System.Web.UI.WebControls.FormView.PageIndexChanging>|Occurs when one of the pager buttons is clicked, but before the <xref:System.Web.UI.WebControls.FormView> control handles the paging operation. This event is often used to cancel the paging operation.|
> [!NOTE]
> These events are not raised when you change the <xref:System.Web.UI.WebControls.FormView.PageIndex%2A> property programmatically.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.AllowPaging%2A> property to enable the paging feature in a <xref:System.Web.UI.WebControls.FormView> control.
[!code-aspx-csharp[FormViewAllowPaging#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewAllowPaging/CS/formviewallowpagingcs.aspx#1)]
[!code-aspx-vb[FormViewAllowPaging#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewAllowPaging/VB/formviewallowpagingvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.BottomPagerRow" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PageCount" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PageIndex" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerSettings" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.TopPagerRow" />
<altmember cref="E:System.Web.UI.WebControls.FormView.PageIndexChanged" />
<altmember cref="E:System.Web.UI.WebControls.FormView.PageIndexChanging" />
</Docs>
</Member>
<Member MemberName="BackImageUrl">
<MemberSignature Language="C#" Value="public virtual string BackImageUrl { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string BackImageUrl" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.BackImageUrl" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property BackImageUrl As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ BackImageUrl { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.BackImageUrl : string with get, set" Usage="System.Web.UI.WebControls.FormView.BackImageUrl" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.ComponentModel.Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.UrlProperty</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5">
<AttributeName>System.ComponentModel.Editor("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the URL to an image to display in the background of a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>The URL to an image to display in the background of the <see cref="T:System.Web.UI.WebControls.FormView" /> control. The default is an empty string (""), which indicates that this property is not set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.BackImageUrl%2A> property to specify the URL to an image to display in the background of a <xref:System.Web.UI.WebControls.FormView> control.
> [!NOTE]
> If the specified image is smaller than the <xref:System.Web.UI.WebControls.FormView> control, the image is tiled to fill in the background. If the image is larger than the control, the image is cropped.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.BackImageUrl%2A> property to display a custom image in the background of a <xref:System.Web.UI.WebControls.FormView> control.
[!code-aspx-csharp[FormViewBackImageUrl#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewBackImageUrl/CS/formviewbackimageurlcs.aspx#1)]
[!code-aspx-vb[FormViewBackImageUrl#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewBackImageUrl/VB/formviewbackimageurlvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.CellPadding" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CellSpacing" />
<altmember cref="P:System.Web.UI.WebControls.FormView.GridLines" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HorizontalAlign" />
</Docs>
</Member>
<Member MemberName="BottomPagerRow">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.WebControls.FormViewRow BottomPagerRow { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.WebControls.FormViewRow BottomPagerRow" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.BottomPagerRow" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property BottomPagerRow As FormViewRow" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::WebControls::FormViewRow ^ BottomPagerRow { System::Web::UI::WebControls::FormViewRow ^ get(); };" />
<MemberSignature Language="F#" Value="member this.BottomPagerRow : System.Web.UI.WebControls.FormViewRow" Usage="System.Web.UI.WebControls.FormView.BottomPagerRow" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.FormViewRow</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the <see cref="T:System.Web.UI.WebControls.FormViewRow" /> object that represents the pager row displayed at the bottom of the <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>A <see cref="T:System.Web.UI.WebControls.FormViewRow" /> object that represents the bottom pager row of a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When paging is enabled (when the <xref:System.Web.UI.WebControls.FormView.AllowPaging%2A> property is set to `true`), an additional row called the pager row is automatically displayed in the <xref:System.Web.UI.WebControls.FormView> control. The pager row contains controls that allow the user to navigate to other records, and can be displayed at the top, the bottom, or both the top and bottom of the control. Use the <xref:System.Web.UI.WebControls.FormView.BottomPagerRow%2A> property to programmatically access the <xref:System.Web.UI.WebControls.FormViewRow> object that represents the bottom pager row in the <xref:System.Web.UI.WebControls.FormView> control.
> [!NOTE]
> The <xref:System.Web.UI.WebControls.FormView.BottomPagerRow%2A> property is available only after the <xref:System.Web.UI.WebControls.FormView> control creates the bottom pager row in the <xref:System.Web.UI.WebControls.FormView.ItemCreated> event.
This property is commonly used when you need to programmatically manipulate the bottom pager row, for example when adding custom content. Any modification to the <xref:System.Web.UI.WebControls.FormView.BottomPagerRow%2A> property must be performed after the <xref:System.Web.UI.WebControls.FormViewRow> object that represents the bottom pager row has been created; otherwise, the <xref:System.Web.UI.WebControls.FormView> control overwrites any changes.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.BottomPagerRow%2A> property to access the pager row displayed at the bottom of a <xref:System.Web.UI.WebControls.FormView> control. The pager row is then updated with additional content.
[!code-aspx-csharp[FormViewPagerTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewPagerTemplate/CS/formviewpagertemplatecs.aspx#1)]
[!code-aspx-vb[FormViewPagerTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewPagerTemplate/VB/formviewpagertemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.FormViewRow" />
<altmember cref="P:System.Web.UI.WebControls.FormView.AllowPaging" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PageCount" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PageIndex" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerSettings" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.TopPagerRow" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemCreated" />
<altmember cref="E:System.Web.UI.WebControls.FormView.PageIndexChanged" />
<altmember cref="E:System.Web.UI.WebControls.FormView.PageIndexChanging" />
</Docs>
</Member>
<Member MemberName="Caption">
<MemberSignature Language="C#" Value="public virtual string Caption { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Caption" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.Caption" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property Caption As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ Caption { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.Caption : string with get, set" Usage="System.Web.UI.WebControls.FormView.Caption" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue("")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the text to render in an HTML caption element in a <see cref="T:System.Web.UI.WebControls.FormView" /> control. This property is provided to make the control more accessible to users of assistive technology devices.</summary>
<value>A string that represents the text to render in an HTML caption element in a <see cref="T:System.Web.UI.WebControls.FormView" /> control. The default value is an empty string ("").</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.Caption%2A> property to specify the text to render in an HTML caption element in a <xref:System.Web.UI.WebControls.FormView> control. The text that you specify provides assistive technology devices with a description of the table that can be used to make the control more accessible.
Additional accessibility support for the <xref:System.Web.UI.WebControls.FormView> control is provided by the <xref:System.Web.UI.WebControls.FormView.CaptionAlign%2A> property. Use the <xref:System.Web.UI.WebControls.FormView.CaptionAlign%2A> property to specify the alignment of the HTML caption element in a <xref:System.Web.UI.WebControls.FormView> control.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see <xref:System.ComponentModel.LocalizableAttribute> and [Globalization and Localization](https://msdn.microsoft.com/library/8ef3838e-9d05-4236-9dd0-ceecff9df80d).
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.Caption%2A> property to specify the text for the HTML caption element rendered in a <xref:System.Web.UI.WebControls.FormView> control.
[!code-aspx-csharp[FormViewCaption#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewCaption/CS/formviewcaptioncs.aspx#1)]
[!code-aspx-vb[FormViewCaption#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewCaption/VB/formviewcaptionvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.CaptionAlign" />
</Docs>
</Member>
<Member MemberName="CaptionAlign">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.WebControls.TableCaptionAlign CaptionAlign { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Web.UI.WebControls.TableCaptionAlign CaptionAlign" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.CaptionAlign" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property CaptionAlign As TableCaptionAlign" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::WebControls::TableCaptionAlign CaptionAlign { System::Web::UI::WebControls::TableCaptionAlign get(); void set(System::Web::UI::WebControls::TableCaptionAlign value); };" />
<MemberSignature Language="F#" Value="member this.CaptionAlign : System.Web.UI.WebControls.TableCaptionAlign with get, set" Usage="System.Web.UI.WebControls.FormView.CaptionAlign" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(Mono.Cecil.CustomAttributeArgument)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.TableCaptionAlign</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the horizontal or vertical position of the HTML caption element in a <see cref="T:System.Web.UI.WebControls.FormView" /> control. This property is provided to make the control more accessible to users of assistive technology devices.</summary>
<value>One of the <see cref="T:System.Web.UI.WebControls.TableCaptionAlign" /> values. The default is <see langword="TableCaptionAlign.NotSet" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.CaptionAlign%2A> property to specify the horizontal or vertical position of the HTML caption element in a <xref:System.Web.UI.WebControls.FormView> control. This property is provided to make the control more accessible to users of assistive technology devices.
This property is set using one of the <xref:System.Web.UI.WebControls.TableCaptionAlign> enumeration values. The following table lists the possible values.
|Value|Description|
|-----------|-----------------|
|`TableCaptionAlign.Bottom`|The caption element is aligned with the bottom of the table.|
|`TableCaptionAlign.Left`|The caption element is aligned with the left side of the table.|
|`TableCaptionAlign.NotSet`|The caption element's alignment is not set.|
|`TableCaptionAlign.Right`|The caption element is aligned with the right side of the table.|
|`TableCaptionAlign.Top`|The caption element is aligned with the top of the table.|
> [!NOTE]
> When this property is set to `TableCaptionAlign.NotSet`, the default value of the browser is used.
Additional accessibility support for the <xref:System.Web.UI.WebControls.FormView> control is provided by the <xref:System.Web.UI.WebControls.FormView.Caption%2A> property. Use the <xref:System.Web.UI.WebControls.FormView.Caption%2A> property to specify the text to render in an HTML caption element in a <xref:System.Web.UI.WebControls.FormView> control.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.CaptionAlign%2A> property to specify that the HTML caption element in a <xref:System.Web.UI.WebControls.FormView> control should be rendered on the left side of the control.
[!code-aspx-csharp[FormViewCaption#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewCaption/CS/formviewcaptioncs.aspx#1)]
[!code-aspx-vb[FormViewCaption#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewCaption/VB/formviewcaptionvb.aspx#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The specified value is not one of the <see cref="T:System.Web.UI.WebControls.TableCaptionAlign" /> enumeration values.</exception>
<altmember cref="T:System.Web.UI.WebControls.TableCaptionAlign" />
<altmember cref="P:System.Web.UI.WebControls.FormView.Caption" />
</Docs>
</Member>
<Member MemberName="CellPadding">
<MemberSignature Language="C#" Value="public virtual int CellPadding { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 CellPadding" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.CellPadding" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property CellPadding As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property int CellPadding { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.CellPadding : int with get, set" Usage="System.Web.UI.WebControls.FormView.CellPadding" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(-1)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the amount of space between the contents of a cell and the cell's border.</summary>
<value>The amount of space, in pixels, between the contents of a cell and the cell's border. The default value is -1, which indicates that this property is not set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.CellPadding%2A> property to control the spacing between the contents of a cell and the cell's border. The padding amount specified is added to all four sides of the cell.
All cells in the same column of a <xref:System.Web.UI.WebControls.FormView> control have the same width. The padding amount is applied to the widest cell and all other cells in the column are adjusted to that cell width. Similarly, all cells in the same row have the same height. The padding amount is applied to the tallest cell in the row and all other cells in the row are adjusted to that cell height. Individual cell sizes cannot be specified.
To adjust the spacing between cells, use the <xref:System.Web.UI.WebControls.FormView.CellSpacing%2A> property.
> [!NOTE]
> When this property is not set, the default value of the browser is used.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.CellPadding%2A> property to specify the amount of spacing between the contents of a cell and the cell's border.
[!code-aspx-csharp[FormViewCellPadding#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewCellPadding/CS/formviewcellpaddingcs.aspx#1)]
[!code-aspx-vb[FormViewCellPadding#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewCellPadding/VB/formviewcellpaddingvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.BackImageUrl" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CellSpacing" />
<altmember cref="P:System.Web.UI.WebControls.FormView.GridLines" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HorizontalAlign" />
</Docs>
</Member>
<Member MemberName="CellSpacing">
<MemberSignature Language="C#" Value="public virtual int CellSpacing { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 CellSpacing" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.CellSpacing" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property CellSpacing As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property int CellSpacing { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.CellSpacing : int with get, set" Usage="System.Web.UI.WebControls.FormView.CellSpacing" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(0)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the amount of space between cells.</summary>
<value>The amount of space, in pixels, between cells. The default value is 0.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.CellSpacing%2A> property to control the spacing between adjacent cells in the <xref:System.Web.UI.WebControls.FormView> control. This spacing is applied both vertically and horizontally. The cell spacing is uniform for the entire control. Individual cell spacing between rows or columns cannot be specified.
> [!NOTE]
> If you set this property to a value greater than 0, and then set the <xref:System.Web.UI.WebControls.FormView.GridLines%2A> property to a value that displays the cell borders, a gap is displayed between the borders of adjacent cells. In this situation, the <xref:System.Web.UI.WebControls.FormView.CellSpacing%2A> property controls the size of the gap.
To adjust the spacing between the contents of a cell and the cell's border, use the <xref:System.Web.UI.WebControls.FormView.CellPadding%2A> property.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.CellSpacing%2A> property to specify the amount of spacing between adjacent cells.
[!code-aspx-csharp[FormViewCellPadding#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewCellPadding/CS/formviewcellpaddingcs.aspx#1)]
[!code-aspx-vb[FormViewCellPadding#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewCellPadding/VB/formviewcellpaddingvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.BackImageUrl" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CellPadding" />
<altmember cref="P:System.Web.UI.WebControls.FormView.GridLines" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HorizontalAlign" />
</Docs>
</Member>
<Member MemberName="ChangeMode">
<MemberSignature Language="C#" Value="public void ChangeMode (System.Web.UI.WebControls.FormViewMode newMode);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void ChangeMode(valuetype System.Web.UI.WebControls.FormViewMode newMode) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.ChangeMode(System.Web.UI.WebControls.FormViewMode)" />
<MemberSignature Language="VB.NET" Value="Public Sub ChangeMode (newMode As FormViewMode)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void ChangeMode(System::Web::UI::WebControls::FormViewMode newMode);" />
<MemberSignature Language="F#" Value="member this.ChangeMode : System.Web.UI.WebControls.FormViewMode -&gt; unit" Usage="formView.ChangeMode newMode" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="newMode" Type="System.Web.UI.WebControls.FormViewMode" />
</Parameters>
<Docs>
<param name="newMode">One of the <see cref="T:System.Web.UI.WebControls.FormViewMode" /> enumeration values.</param>
<summary>Switches the <see cref="T:System.Web.UI.WebControls.FormView" /> control to the specified data-entry mode.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.ChangeMode%2A> method to programmatically switch the <xref:System.Web.UI.WebControls.FormView> control between edit, insert, and read-only modes. This method also updates the <xref:System.Web.UI.WebControls.FormView.CurrentMode%2A> property with the specified mode. The following table lists the different mode values.
|Mode|Description|
|----------|-----------------|
|`FormViewMode.Edit`|The <xref:System.Web.UI.WebControls.FormView> control is in edit mode, which allows the user to update the values of a record.|
|`FormViewMode.Insert`|The <xref:System.Web.UI.WebControls.FormView> control is in insert mode, which allows the user to add a new record to the data source.|
|`FormView.ReadOnly`|The <xref:System.Web.UI.WebControls.FormView> control is in read-only mode, which is the normal display mode.|
> [!NOTE]
> The <xref:System.Web.UI.WebControls.FormView.ModeChanged> and <xref:System.Web.UI.WebControls.FormView.ModeChanging> events are not raised when this method is called.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.ChangeMode%2A> method to return the <xref:System.Web.UI.WebControls.FormView> control to read-only mode whenever the user navigates to another record.
[!code-aspx-csharp[FormViewChangeMode#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewChangeMode/CS/formviewchangemodecs.aspx#1)]
[!code-aspx-vb[FormViewChangeMode#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewChangeMode/VB/formviewchangemodevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.FormViewMode" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CurrentMode" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ModeChanged" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ModeChanging" />
</Docs>
</Member>
<Member MemberName="CreateChildControls">
<MemberSignature Language="C#" Value="protected override int CreateChildControls (System.Collections.IEnumerable dataSource, bool dataBinding);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance int32 CreateChildControls(class System.Collections.IEnumerable dataSource, bool dataBinding) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.CreateChildControls(System.Collections.IEnumerable,System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function CreateChildControls (dataSource As IEnumerable, dataBinding As Boolean) As Integer" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override int CreateChildControls(System::Collections::IEnumerable ^ dataSource, bool dataBinding);" />
<MemberSignature Language="F#" Value="override this.CreateChildControls : System.Collections.IEnumerable * bool -&gt; int" Usage="formView.CreateChildControls (dataSource, dataBinding)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dataSource" Type="System.Collections.IEnumerable" />
<Parameter Name="dataBinding" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="dataSource">An <see cref="T:System.Collections.IEnumerable" /> that represents the data source used to create the control hierarchy.</param>
<param name="dataBinding">
<see langword="true" /> to indicate that the control hierarchy is created directly from the data source; <see langword="false" /> to indicate the control hierarchy is created from the view state.</param>
<summary>Creates the control hierarchy used to render the <see cref="T:System.Web.UI.WebControls.FormView" /> control with the specified data source.</summary>
<returns>The number of items created from the data source.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormView.CreateChildControls%28System.Collections.IEnumerable%2CSystem.Boolean%29> method is a helper method called by the <xref:System.Web.UI.WebControls.FormView> control to create the control hierarchy for the <xref:System.Web.UI.WebControls.FormView> control. When the `dataBinding` parameter is `true`, data binding is performed before the control hierarchy is created.
]]></format>
</remarks>
<exception cref="T:System.Web.HttpException">The <see cref="T:System.Web.UI.DataSourceView" /> of the <see cref="T:System.Web.UI.IDataSource" /> to which the <see cref="T:System.Web.UI.WebControls.FormView" /> control is bound is <see langword="null" />.</exception>
<block subset="none" type="overrides">
<para>When extending the <see cref="T:System.Web.UI.WebControls.FormView" /> class, you can override this method to create your own control hierarchy.</para>
</block>
<altmember cref="T:System.Collections.IEnumerable" />
<altmember cref="M:System.Web.UI.Control.CreateChildControls" />
</Docs>
</Member>
<Member MemberName="CreateControlStyle">
<MemberSignature Language="C#" Value="protected override System.Web.UI.WebControls.Style CreateControlStyle ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance class System.Web.UI.WebControls.Style CreateControlStyle() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.CreateControlStyle" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function CreateControlStyle () As Style" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override System::Web::UI::WebControls::Style ^ CreateControlStyle();" />
<MemberSignature Language="F#" Value="override this.CreateControlStyle : unit -&gt; System.Web.UI.WebControls.Style" Usage="formView.CreateControlStyle " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.Style</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates a default table style object for the <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<returns>A <see cref="T:System.Web.UI.WebControls.Style" /> that contains the default table style for the <see cref="T:System.Web.UI.WebControls.FormView" /> control.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormView.CreateControlStyle%2A> method is a helper method called by the <xref:System.Web.UI.WebControls.FormView> control to create its default table style object. In addition to setting the default style of a <xref:System.Web.UI.WebControls.TableStyle> object, this method also sets the <xref:System.Web.UI.WebControls.FormView.CellPadding%2A> property to 0.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>When extending the <see cref="T:System.Web.UI.WebControls.FormView" /> class, you can override this method to create your own default style.</para>
</block>
<altmember cref="T:System.Web.UI.WebControls.Style" />
<altmember cref="T:System.Web.UI.WebControls.TableStyle" />
</Docs>
</Member>
<Member MemberName="CreateDataSourceSelectArguments">
<MemberSignature Language="C#" Value="protected override System.Web.UI.DataSourceSelectArguments CreateDataSourceSelectArguments ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance class System.Web.UI.DataSourceSelectArguments CreateDataSourceSelectArguments() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.CreateDataSourceSelectArguments" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function CreateDataSourceSelectArguments () As DataSourceSelectArguments" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override System::Web::UI::DataSourceSelectArguments ^ CreateDataSourceSelectArguments();" />
<MemberSignature Language="F#" Value="override this.CreateDataSourceSelectArguments : unit -&gt; System.Web.UI.DataSourceSelectArguments" Usage="formView.CreateDataSourceSelectArguments " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.UI.DataSourceSelectArguments</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates the <see cref="T:System.Web.UI.DataSourceSelectArguments" /> object that contains the arguments that are passed to the data source for processing.</summary>
<returns>A <see cref="T:System.Web.UI.DataSourceSelectArguments" /> that contains the arguments that are passed to the data source.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormView.CreateDataSourceSelectArguments%2A> method is a helper method called by the <xref:System.Web.UI.WebControls.FormView> control to create the <xref:System.Web.UI.DataSourceSelectArguments> object that contains the arguments passed to the data source. In this implementation, the <xref:System.Web.UI.DataSourceSelectArguments> object contains the arguments for paging operations.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>When extending the <see cref="T:System.Web.UI.WebControls.FormView" /> class, you can override this method to specify your own values that are passed to the data source.</para>
</block>
<altmember cref="T:System.Web.UI.DataSourceSelectArguments" />
<altmember cref="M:System.Web.UI.WebControls.DataBoundControl.CreateDataSourceSelectArguments" />
</Docs>
</Member>
<Member MemberName="CreateRow">
<MemberSignature Language="C#" Value="protected virtual System.Web.UI.WebControls.FormViewRow CreateRow (int itemIndex, System.Web.UI.WebControls.DataControlRowType rowType, System.Web.UI.WebControls.DataControlRowState rowState);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class System.Web.UI.WebControls.FormViewRow CreateRow(int32 itemIndex, valuetype System.Web.UI.WebControls.DataControlRowType rowType, valuetype System.Web.UI.WebControls.DataControlRowState rowState) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.CreateRow(System.Int32,System.Web.UI.WebControls.DataControlRowType,System.Web.UI.WebControls.DataControlRowState)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Function CreateRow (itemIndex As Integer, rowType As DataControlRowType, rowState As DataControlRowState) As FormViewRow" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual System::Web::UI::WebControls::FormViewRow ^ CreateRow(int itemIndex, System::Web::UI::WebControls::DataControlRowType rowType, System::Web::UI::WebControls::DataControlRowState rowState);" />
<MemberSignature Language="F#" Value="abstract member CreateRow : int * System.Web.UI.WebControls.DataControlRowType * System.Web.UI.WebControls.DataControlRowState -&gt; System.Web.UI.WebControls.FormViewRow&#xA;override this.CreateRow : int * System.Web.UI.WebControls.DataControlRowType * System.Web.UI.WebControls.DataControlRowState -&gt; System.Web.UI.WebControls.FormViewRow" Usage="formView.CreateRow (itemIndex, rowType, rowState)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.FormViewRow</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="itemIndex" Type="System.Int32" />
<Parameter Name="rowType" Type="System.Web.UI.WebControls.DataControlRowType" />
<Parameter Name="rowState" Type="System.Web.UI.WebControls.DataControlRowState" />
</Parameters>
<Docs>
<param name="itemIndex">The zero-based index of the data item to display.</param>
<param name="rowType">One of the <see cref="T:System.Web.UI.WebControls.DataControlRowType" /> enumeration values.</param>
<param name="rowState">A bitwise combination of the <see cref="T:System.Web.UI.WebControls.DataControlRowState" /> enumeration values.</param>
<summary>Creates a <see cref="T:System.Web.UI.WebControls.FormViewRow" /> object using the specified item index, row type, and row state.</summary>
<returns>A <see cref="T:System.Web.UI.WebControls.FormViewRow" /> with the specified item index, row type, and row state.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormView.CreateRow%2A> method is a helper method called by the <xref:System.Web.UI.WebControls.FormView> control to create a <xref:System.Web.UI.WebControls.FormViewRow> object used to represent a row within the control.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>When extending the <see cref="T:System.Web.UI.WebControls.FormView" /> class, you can override this method to return a <see cref="T:System.Web.UI.WebControls.FormViewRow" /> object with custom settings.</para>
</block>
<altmember cref="T:System.Web.UI.WebControls.FormViewRow" />
<altmember cref="T:System.Web.UI.WebControls.DataControlRowType" />
<altmember cref="T:System.Web.UI.WebControls.DataControlRowState" />
</Docs>
</Member>
<Member MemberName="CreateTable">
<MemberSignature Language="C#" Value="protected virtual System.Web.UI.WebControls.Table CreateTable ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class System.Web.UI.WebControls.Table CreateTable() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.CreateTable" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Function CreateTable () As Table" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual System::Web::UI::WebControls::Table ^ CreateTable();" />
<MemberSignature Language="F#" Value="abstract member CreateTable : unit -&gt; System.Web.UI.WebControls.Table&#xA;override this.CreateTable : unit -&gt; System.Web.UI.WebControls.Table" Usage="formView.CreateTable " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.Table</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates the containing table for the <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<returns>A <see cref="T:System.Web.UI.WebControls.Table" /> that represents the containing table for the <see cref="T:System.Web.UI.WebControls.FormView" /> control.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormView.CreateTable%2A> method is a helper method called by the <xref:System.Web.UI.WebControls.FormView> control to create a table that acts as the container for the control.
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.Table" />
</Docs>
</Member>
<Member MemberName="CurrentMode">
<MemberSignature Language="C#" Value="public System.Web.UI.WebControls.FormViewMode CurrentMode { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Web.UI.WebControls.FormViewMode CurrentMode" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.CurrentMode" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property CurrentMode As FormViewMode" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Web::UI::WebControls::FormViewMode CurrentMode { System::Web::UI::WebControls::FormViewMode get(); };" />
<MemberSignature Language="F#" Value="member this.CurrentMode : System.Web.UI.WebControls.FormViewMode" Usage="System.Web.UI.WebControls.FormView.CurrentMode" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.FormViewMode</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the current data-entry mode of the <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>One of the <see cref="T:System.Web.UI.WebControls.FormViewMode" /> values.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.CurrentMode%2A> property to determine whether the <xref:System.Web.UI.WebControls.FormView> control is in edit, insert, or read-only mode. The following table lists the different mode values.
|Mode|Description|
|----------|-----------------|
|`FormViewMode.Edit`|The <xref:System.Web.UI.WebControls.FormView> control is in edit mode, which allows the user to update the values of a record.|
|`FormViewMode.Insert`|The <xref:System.Web.UI.WebControls.FormView> control is in insert mode, which allows the user to add a new record to the data source.|
|`FormView.ReadOnly`|The <xref:System.Web.UI.WebControls.FormView> control is in read-only mode, which is the normal display mode.|
This value is normally set automatically by the <xref:System.Web.UI.WebControls.FormView> control when the New, Update, Insert, Delete, or Cancel command button is clicked. When the <xref:System.Web.UI.WebControls.FormView> control changes modes in response to an action, the events in the following table are raised. This allows you to create a custom event handler that performs the appropriate routine when the event occurs.
|Event|Description|
|-----------|-----------------|
|<xref:System.Web.UI.WebControls.FormView.ModeChanged>|Occurs when the <xref:System.Web.UI.WebControls.FormView> control changes modes, but after the mode changes. This event is commonly used to perform a task whenever the <xref:System.Web.UI.WebControls.FormView> control changes modes.|
|<xref:System.Web.UI.WebControls.FormView.ModeChanging>|Occurs when the <xref:System.Web.UI.WebControls.FormView> control changes modes, but before the mode changes. This event is commonly used to cancel the mode change.|
**Note** These events are not raised when you change the mode programmatically by using the <xref:System.Web.UI.WebControls.FormView.ChangeMode%2A> method.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.CurrentMode%2A> property to determine whether the <xref:System.Web.UI.WebControls.FormView> control is in edit, insert, or read-only mode. If the user attempts to navigate to another record while the <xref:System.Web.UI.WebControls.FormView> control is in edit more, the paging operation is canceled.
[!code-aspx-csharp[FormViewCurrentMode#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewCurrentMode/CS/formviewcurrentmodecs.aspx#1)]
[!code-aspx-vb[FormViewCurrentMode#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewCurrentMode/VB/formviewcurrentmodevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.FormViewMode" />
<altmember cref="P:System.Web.UI.WebControls.FormView.DefaultMode" />
<altmember cref="M:System.Web.UI.WebControls.FormView.ChangeMode(System.Web.UI.WebControls.FormViewMode)" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ModeChanged" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ModeChanging" />
</Docs>
</Member>
<Member MemberName="DataBind">
<MemberSignature Language="C#" Value="public override sealed void DataBind ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance void DataBind() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.DataBind" />
<MemberSignature Language="VB.NET" Value="Public Overrides NotOverridable Sub DataBind ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; override void DataBind();" />
<MemberSignature Language="F#" Value="override this.DataBind : unit -&gt; unit" Usage="formView.DataBind " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Binds the data source to the <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.DataBind> method to bind data from a data source to the <xref:System.Web.UI.WebControls.FormView> control. This method resolves all data-binding expressions in the active template of the control.
]]></format>
</remarks>
<altmember cref="M:System.Web.UI.WebControls.BaseDataBoundControl.DataBind" />
</Docs>
</Member>
<Member MemberName="DataItem">
<MemberSignature Language="C#" Value="public virtual object DataItem { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance object DataItem" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.DataItem" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property DataItem As Object" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Object ^ DataItem { System::Object ^ get(); };" />
<MemberSignature Language="F#" Value="member this.DataItem : obj" Usage="System.Web.UI.WebControls.FormView.DataItem" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Web.UI.IDataItemContainer.DataItem</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the data item bound to the <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>An <see cref="T:System.Object" /> that represents the data item bound to the <see cref="T:System.Web.UI.WebControls.FormView" /> control.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.DataItem%2A> property to access the data item bound to the <xref:System.Web.UI.WebControls.FormView> control. The data item is often used to access the field values of the current record directly. The type of the <xref:System.Object> returned by this property varies depending on the data source. For example, when a <xref:System.Web.UI.WebControls.SqlDataSource> control is bound to the <xref:System.Web.UI.WebControls.FormView> control, a <xref:System.Data.DataRowView> object is returned.
> [!NOTE]
> This property is available only after data binding has occurred. Before data binding occurs, this property returns `null`. This property is also not applicable when the <xref:System.Web.UI.WebControls.FormView> control is in insert mode and returns `null`.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.DataItem%2A> property to determine the value of a field in the data item.
[!code-aspx-csharp[FormViewCtor#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewCtor/CS/formviewctorcs.aspx#1)]
[!code-aspx-vb[FormViewCtor#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewCtor/VB/formviewctorvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Object" />
<altmember cref="Overload:System.Web.UI.DataBinder.Eval" />
<altmember cref="P:System.Web.UI.WebControls.FormView.DataItemCount" />
<altmember cref="P:System.Web.UI.WebControls.FormView.DataItemIndex" />
</Docs>
</Member>
<Member MemberName="DataItemCount">
<MemberSignature Language="C#" Value="public int DataItemCount { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 DataItemCount" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.DataItemCount" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property DataItemCount As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int DataItemCount { int get(); };" />
<MemberSignature Language="F#" Value="member this.DataItemCount : int" Usage="System.Web.UI.WebControls.FormView.DataItemCount" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the number of data items in the data source.</summary>
<value>The number of data items in the data source.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.DataItemCount%2A> property to determine the number of data items contained in the data source. This property contains the same value as the <xref:System.Web.UI.WebControls.FormView.PageCount%2A> property.
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.DataItem" />
<altmember cref="P:System.Web.UI.WebControls.FormView.DataItemIndex" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PageCount" />
</Docs>
</Member>
<Member MemberName="DataItemIndex">
<MemberSignature Language="C#" Value="public virtual int DataItemIndex { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 DataItemIndex" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.DataItemIndex" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property DataItemIndex As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property int DataItemIndex { int get(); };" />
<MemberSignature Language="F#" Value="member this.DataItemIndex : int" Usage="System.Web.UI.WebControls.FormView.DataItemIndex" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Web.UI.IDataItemContainer.DataItemIndex</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the index of the data item bound to the <see cref="T:System.Web.UI.WebControls.FormView" /> control from the data source.</summary>
<value>The index of the data item bound to the <see cref="T:System.Web.UI.WebControls.FormView" /> control from the data source.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.DataItemIndex%2A> property to determine the index of the data item bound to the <xref:System.Web.UI.WebControls.FormView> control from the data source. This property contains the same value as the <xref:System.Web.UI.WebControls.FormView.PageIndex%2A> property.
> [!NOTE]
> This property is not applicable when the <xref:System.Web.UI.WebControls.FormView> control is in insert mode. When the control is in insert mode, the <xref:System.Web.UI.WebControls.FormView.DataItemIndex%2A> property returns -1.
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.DataItem" />
<altmember cref="P:System.Web.UI.WebControls.FormView.DataItemCount" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PageIndex" />
</Docs>
</Member>
<Member MemberName="DataKey">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.WebControls.DataKey DataKey { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.WebControls.DataKey DataKey" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.DataKey" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property DataKey As DataKey" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::WebControls::DataKey ^ DataKey { System::Web::UI::WebControls::DataKey ^ get(); };" />
<MemberSignature Language="F#" Value="member this.DataKey : System.Web.UI.WebControls.DataKey" Usage="System.Web.UI.WebControls.FormView.DataKey" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Web.UI.WebControls.IDataBoundItemControl.DataKey</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.DataKey</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a <see cref="T:System.Web.UI.WebControls.DataKey" /> object that represents the primary key of the displayed record.</summary>
<value>A <see cref="T:System.Web.UI.WebControls.DataKey" /> object that represents the primary key of the displayed record.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When the <xref:System.Web.UI.WebControls.FormView.DataKeyNames%2A> property is set, the <xref:System.Web.UI.WebControls.FormView> control automatically creates a <xref:System.Web.UI.WebControls.DataKey> object that contains the key/value pairs of the field or fields listed in the <xref:System.Web.UI.WebControls.FormView.DataKeyNames%2A> property for the current record. Use the <xref:System.Web.UI.WebControls.FormView.DataKey%2A> property to get this <xref:System.Web.UI.WebControls.DataKey> object. This property is commonly used to obtain the keys and their corresponding values for the fields specified in the <xref:System.Web.UI.WebControls.FormView.DataKeyNames%2A> property.
> [!NOTE]
> As a shortcut, you can also use the <xref:System.Web.UI.WebControls.FormView.SelectedValue%2A> property to determine the value of the first key field listed in the <xref:System.Web.UI.WebControls.FormView.DataKeyNames%2A> property.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.DataKey%2A> property to determine the value of the key field.
[!code-aspx-csharp[FormViewDataKey#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewDataKey/CS/formviewdatakeycs.aspx#1)]
[!code-aspx-vb[FormViewDataKey#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewDataKey/VB/formviewdatakeyvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.DataKey" />
<altmember cref="P:System.Web.UI.WebControls.FormView.DataKeyNames" />
<altmember cref="P:System.Web.UI.WebControls.FormView.SelectedValue" />
</Docs>
</Member>
<Member MemberName="DataKeyNames">
<MemberSignature Language="C#" Value="public virtual string[] DataKeyNames { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string[] DataKeyNames" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.DataKeyNames" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property DataKeyNames As String()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property cli::array &lt;System::String ^&gt; ^ DataKeyNames { cli::array &lt;System::String ^&gt; ^ get(); void set(cli::array &lt;System::String ^&gt; ^ value); };" />
<MemberSignature Language="F#" Value="member this.DataKeyNames : string[] with get, set" Usage="System.Web.UI.WebControls.FormView.DataKeyNames" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Web.UI.WebControls.IDataBoundControl.DataKeyNames</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.ComponentModel.Editor("System.Web.UI.Design.WebControls.DataFieldEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.StringArrayConverter))</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5">
<AttributeName>System.ComponentModel.Editor("System.Web.UI.Design.WebControls.DataFieldEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets an array that contains the names of the key fields for the data source.</summary>
<value>An array that contains the names of the key fields for the data source.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.DataKeyNames%2A> property to specify a comma-separated list of field names that represent the primary key of the data source. When the <xref:System.Web.UI.WebControls.FormView.DataKeyNames%2A> property is set, the <xref:System.Web.UI.WebControls.FormView> control automatically creates a <xref:System.Web.UI.WebControls.DataKey> object that contains the key/value pairs of the field or fields listed in the <xref:System.Web.UI.WebControls.FormView.DataKeyNames%2A> property for the current record. The <xref:System.Web.UI.WebControls.DataKey> object is then stored in the <xref:System.Web.UI.WebControls.FormView.DataKey%2A> property.
> [!NOTE]
> You must set the <xref:System.Web.UI.WebControls.FormView.DataKeyNames%2A> property for the built-in updating, deleting, and inserting features of the <xref:System.Web.UI.WebControls.FormView> control to work.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.DataKeyNames%2A> property to specify the key field for the data source bound to the <xref:System.Web.UI.WebControls.FormView> control.
[!code-aspx-csharp[FormViewEditItemTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewEditItemTemplate/CS/formviewedititemtemplatecs.aspx#1)]
[!code-aspx-vb[FormViewEditItemTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewEditItemTemplate/VB/formviewedititemtemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.DataKey" />
<altmember cref="P:System.Web.UI.WebControls.FormView.DataKey" />
<altmember cref="P:System.Web.UI.WebControls.FormView.SelectedValue" />
</Docs>
</Member>
<Member MemberName="DefaultMode">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.WebControls.FormViewMode DefaultMode { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Web.UI.WebControls.FormViewMode DefaultMode" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.DefaultMode" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property DefaultMode As FormViewMode" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::WebControls::FormViewMode DefaultMode { System::Web::UI::WebControls::FormViewMode get(); void set(System::Web::UI::WebControls::FormViewMode value); };" />
<MemberSignature Language="F#" Value="member this.DefaultMode : System.Web.UI.WebControls.FormViewMode with get, set" Usage="System.Web.UI.WebControls.FormView.DefaultMode" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(Mono.Cecil.CustomAttributeArgument)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.FormViewMode</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the data-entry mode to which the <see cref="T:System.Web.UI.WebControls.FormView" /> control returns after an update, insert, or cancel operation.</summary>
<value>One of the <see cref="T:System.Web.UI.WebControls.FormViewMode" /> values. The default is <see langword="FormViewMode.ReadOnly" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.DefaultMode%2A> property to specify whether the <xref:System.Web.UI.WebControls.FormView> control returns to edit, insert, or read-only mode after an update, insert, or cancel operation is performed. By default, the <xref:System.Web.UI.WebControls.FormView> control returns to read-only mode; however, you can keep the <xref:System.Web.UI.WebControls.FormView> control in edit or insert mode by setting this property to the appropriate value. The following table lists the different mode values.
|Mode|Description|
|----------|-----------------|
|`FormViewMode.Edit`|The <xref:System.Web.UI.WebControls.FormView> control is in edit mode, which allows the user to update the values of a record.|
|`FormViewMode.Insert`|The <xref:System.Web.UI.WebControls.FormView> control is in insert mode, which allows the user to add a new record to the data source.|
|`FormViewMode.ReadOnly`|The <xref:System.Web.UI.WebControls.FormView> control is in read-only mode, which is the normal display mode.|
This property is commonly used when the <xref:System.Web.UI.WebControls.FormView> control has a single purpose, such as only to insert or edit records.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.DefaultMode%2A> property to keep a <xref:System.Web.UI.WebControls.FormView> control in edit mode after an update operation.
[!code-aspx-csharp[FormViewDefaultMode#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewDefaultMode/CS/formviewdefaultmodecs.aspx#1)]
[!code-aspx-vb[FormViewDefaultMode#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewDefaultMode/VB/formviewdefaultmodevb.aspx#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The specified value is not one of the <see cref="T:System.Web.UI.WebControls.FormViewMode" /> enumeration values.</exception>
<altmember cref="T:System.Web.UI.WebControls.FormViewMode" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CurrentMode" />
<altmember cref="M:System.Web.UI.WebControls.FormView.ChangeMode(System.Web.UI.WebControls.FormViewMode)" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ModeChanged" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ModeChanging" />
</Docs>
</Member>
<Member MemberName="DeleteItem">
<MemberSignature Language="C#" Value="public virtual void DeleteItem ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void DeleteItem() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.DeleteItem" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub DeleteItem ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void DeleteItem();" />
<MemberSignature Language="F#" Value="abstract member DeleteItem : unit -&gt; unit&#xA;override this.DeleteItem : unit -&gt; unit" Usage="formView.DeleteItem " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Deletes the current record in the <see cref="T:System.Web.UI.WebControls.FormView" /> control from the data source.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.DeleteItem%2A> method to programmatically delete the current record in the <xref:System.Web.UI.WebControls.FormView> control from the data source. This method is commonly used when you need to delete the current record from outside of the <xref:System.Web.UI.WebControls.FormView> control, such as from a different control on the page. Calling this method also raises the <xref:System.Web.UI.WebControls.FormView.ItemDeleted> and <xref:System.Web.UI.WebControls.FormView.ItemDeleting> events.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.DeleteItem%2A> method to programmatically delete the current record in a <xref:System.Web.UI.WebControls.FormView> control from the data source.
[!code-aspx-csharp[FormViewDeleteItem#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewDeleteItem/CS/formviewdeleteitemcs.aspx#1)]
[!code-aspx-vb[FormViewDeleteItem#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewDeleteItem/VB/formviewdeleteitemvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.ItemTemplate" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemDeleted" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemDeleting" />
<altmember cref="M:System.Web.UI.WebControls.FormView.InsertItem(System.Boolean)" />
<altmember cref="M:System.Web.UI.WebControls.FormView.UpdateItem(System.Boolean)" />
</Docs>
</Member>
<Member MemberName="DeleteMethod">
<MemberSignature Language="C#" Value="public virtual string DeleteMethod { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string DeleteMethod" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.DeleteMethod" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property DeleteMethod As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ DeleteMethod { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.DeleteMethod : string with get, set" Usage="System.Web.UI.WebControls.FormView.DeleteMethod" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Web.UI.Themeable(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the name of the method on the page that is called when the control performs a delete operation.</summary>
<value>The name of the method on the page that is called when the control performs a delete operation.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For a tutorial series on using model binding with Web Forms, see [Model Binding and Web Forms](/aspnet/web-forms/overview/presenting-and-managing-data/model-binding/retrieving-data).
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="EditItemTemplate">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.ITemplate EditItemTemplate { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.ITemplate EditItemTemplate" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.EditItemTemplate" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property EditItemTemplate As ITemplate" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::ITemplate ^ EditItemTemplate { System::Web::UI::ITemplate ^ get(); void set(System::Web::UI::ITemplate ^ value); };" />
<MemberSignature Language="F#" Value="member this.EditItemTemplate : System.Web.UI.ITemplate with get, set" Usage="System.Web.UI.WebControls.FormView.EditItemTemplate" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.FormView), System.ComponentModel.BindingDirection.TwoWay)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.ITemplate</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the custom content for an item in edit mode.</summary>
<value>A <see cref="T:System.Web.UI.ITemplate" /> that contains the custom content for the data row when the <see cref="T:System.Web.UI.WebControls.FormView" /> control is in edit mode. The default value is null, which indicates that this property is not set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref: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 <xref:System.Web.UI.WebControls.FormView.CurrentMode%2A> property). The following table shows which template is used for each mode.
|Mode|Template rendered|
|----------|-----------------------|
|Edit|<xref:System.Web.UI.WebControls.FormView.EditItemTemplate%2A>|
|Insert|<xref:System.Web.UI.WebControls.FormView.InsertItemTemplate%2A>|
|Read-only|<xref:System.Web.UI.WebControls.FormView.ItemTemplate%2A>|
Use the <xref:System.Web.UI.WebControls.FormView.EditItemTemplate%2A> property to define your own user interface (UI) for the data row when the <xref:System.Web.UI.WebControls.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 <xref:System.Web.UI.WebControls.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 <xref:System.Web.UI.WebControls.FormView> control to automatically display the original field value in the associated input control in edit mode. When a record is updated, the <xref:System.Web.UI.WebControls.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](https://msdn.microsoft.com/library/ab7b2846-975b-4057-a948-45527497c742). 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 <xref:System.Web.UI.WebControls.FormView.EditRowStyle%2A> property.
## Examples
The following example demonstrates how to define a custom template for a data row in edit mode.
[!code-aspx-csharp[FormViewEditItemTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewEditItemTemplate/CS/formviewedititemtemplatecs.aspx#1)]
[!code-aspx-vb[FormViewEditItemTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewEditItemTemplate/VB/formviewedititemtemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.ITemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.ItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerTemplate" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemUpdated" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemUpdating" />
</Docs>
</Member>
<Member MemberName="EditRowStyle">
<MemberSignature Language="C#" Value="public System.Web.UI.WebControls.TableItemStyle EditRowStyle { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.WebControls.TableItemStyle EditRowStyle" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.EditRowStyle" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property EditRowStyle As TableItemStyle" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Web::UI::WebControls::TableItemStyle ^ EditRowStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };" />
<MemberSignature Language="F#" Value="member this.EditRowStyle : System.Web.UI.WebControls.TableItemStyle" Usage="System.Web.UI.WebControls.FormView.EditRowStyle" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.NotifyParentProperty(true)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.TableItemStyle</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a reference to the <see cref="T:System.Web.UI.WebControls.TableItemStyle" /> object that allows you to set the appearance of the data row when a <see cref="T:System.Web.UI.WebControls.FormView" /> control is in edit mode.</summary>
<value>A reference to the <see cref="T:System.Web.UI.WebControls.TableItemStyle" /> that represents the style of the data row when a <see cref="T:System.Web.UI.WebControls.FormView" /> control is in edit mode.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.EditRowStyle%2A> property to control the appearance of the data row when a <xref:System.Web.UI.WebControls.FormView> control is in edit mode. When the <xref:System.Web.UI.WebControls.FormView> control is in edit mode, the data row displays the user-defined content specified by the <xref:System.Web.UI.WebControls.FormView.EditItemTemplate%2A> property. This property is read-only; however, you can set the properties of the <xref:System.Web.UI.WebControls.TableItemStyle> object it returns. The properties can be set declaratively using one of the following methods:
- Place an attribute in the opening tag of the <xref:System.Web.UI.WebControls.FormView> control in the form `Property-Subproperty`, where `Subproperty` is a property of the <xref:System.Web.UI.WebControls.TableItemStyle> object (for example, `EditRowStyle-ForeColor`).
- Nest an `<EditRowStyle>` element between the opening and closing tags of the <xref:System.Web.UI.WebControls.FormView> control.
The properties can also be set programmatically in the form `Property.Subproperty` (for example, `EditRowStyle.ForeColor`). Common settings usually include a custom background color, foreground color, and font properties.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.EditRowStyle%2A> property to specify a custom style for a data row when a <xref:System.Web.UI.WebControls.FormView> control is in edit mode.
[!code-aspx-csharp[FormViewEditItemTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewEditItemTemplate/CS/formviewedititemtemplatecs.aspx#1)]
[!code-aspx-vb[FormViewEditItemTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewEditItemTemplate/VB/formviewedititemtemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.TableItemStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.RowStyle" />
</Docs>
</Member>
<Member MemberName="EmptyDataRowStyle">
<MemberSignature Language="C#" Value="public System.Web.UI.WebControls.TableItemStyle EmptyDataRowStyle { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.WebControls.TableItemStyle EmptyDataRowStyle" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.EmptyDataRowStyle" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property EmptyDataRowStyle As TableItemStyle" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Web::UI::WebControls::TableItemStyle ^ EmptyDataRowStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };" />
<MemberSignature Language="F#" Value="member this.EmptyDataRowStyle : System.Web.UI.WebControls.TableItemStyle" Usage="System.Web.UI.WebControls.FormView.EmptyDataRowStyle" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.NotifyParentProperty(true)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.TableItemStyle</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a reference to the <see cref="T:System.Web.UI.WebControls.TableItemStyle" /> object that allows you to set the appearance of the empty data row displayed when the data source bound to a <see cref="T:System.Web.UI.WebControls.FormView" /> control does not contain any records.</summary>
<value>A reference to the <see cref="T:System.Web.UI.WebControls.TableItemStyle" /> that allows you to set the appearance of the empty data row.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.EmptyDataRowStyle%2A> property to control the appearance of the empty data row in a <xref:System.Web.UI.WebControls.FormView> control. The empty data row is displayed when the data source that is bound to the control does not contain any records. This property is read-only; however, you can set the properties of the <xref:System.Web.UI.WebControls.TableItemStyle> object it returns. The properties can be set declaratively using one of the following methods:
- Place an attribute in the opening tag of the <xref:System.Web.UI.WebControls.FormView> control in the form `Property-Subproperty`, where `Subproperty` is a property of the <xref:System.Web.UI.WebControls.TableItemStyle> object (for example, `EmptyDataRowStyle-ForeColor`).
- Nest an `<EmptyDataRowStyle>` element between the opening and closing tags of the <xref:System.Web.UI.WebControls.FormView> control.
The properties can also be set programmatically in the form `Property.Subproperty` (for example, `EmptyDataRowStyle.ForeColor`). Common settings usually include a custom background color, foreground color, and font properties.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.EmptyDataRowStyle%2A> property to specify a custom style for the empty data row displayed when a <xref:System.Web.UI.WebControls.FormView> control is bound to a data source that does not contain any records.
[!code-aspx-csharp[FormViewEmptyDataText#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewEmptyDataText/CS/formviewemptydatatextcs.aspx#1)]
[!code-aspx-vb[FormViewEmptyDataText#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewEmptyDataText/VB/formviewemptydatatextvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.TableItemStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.RowStyle" />
</Docs>
</Member>
<Member MemberName="EmptyDataTemplate">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.ITemplate EmptyDataTemplate { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.ITemplate EmptyDataTemplate" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.EmptyDataTemplate" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property EmptyDataTemplate As ITemplate" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::ITemplate ^ EmptyDataTemplate { System::Web::UI::ITemplate ^ get(); void set(System::Web::UI::ITemplate ^ value); };" />
<MemberSignature Language="F#" Value="member this.EmptyDataTemplate : System.Web.UI.ITemplate with get, set" Usage="System.Web.UI.WebControls.FormView.EmptyDataTemplate" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.FormView))</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.ITemplate</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the user-defined content for the empty data row rendered when a <see cref="T:System.Web.UI.WebControls.FormView" /> control is bound to a data source that does not contain any records.</summary>
<value>A <see cref="T:System.Web.UI.ITemplate" /> that contains the custom content for the empty data row. The default value is <see langword="null" />, which indicates that this property is not set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The empty data row is displayed in a <xref:System.Web.UI.WebControls.FormView> control when the data source that is bound to the control does not contain any records. You can define your own custom user interface (UI) for the empty data row by using the <xref:System.Web.UI.WebControls.FormView.EmptyDataTemplate%2A> property. To specify a custom template for the empty data row, first place `<EmptyDataTemplate>` tags between the opening and closing tags of the <xref:System.Web.UI.WebControls.FormView> control. You can then list the contents of the template between the opening and closing `<EmptyDataTemplate>` tags. To control the style of the empty data row, use the <xref:System.Web.UI.WebControls.FormView.EmptyDataRowStyle%2A> property. Alternatively, you can use the built-in UI for the empty data row by setting the <xref:System.Web.UI.WebControls.FormView.EmptyDataText%2A> property instead of this property.
> [!NOTE]
> If both the <xref:System.Web.UI.WebControls.FormView.EmptyDataText%2A> and <xref:System.Web.UI.WebControls.FormView.EmptyDataTemplate%2A> properties are set, the <xref:System.Web.UI.WebControls.FormView.EmptyDataTemplate%2A> property takes precedence.
## Examples
The following example demonstrates how to define a custom template for the empty data row displayed when a <xref:System.Web.UI.WebControls.FormView> control is bound to a data source that does not contain any records.
[!code-aspx-csharp[FormViewEmptyDataTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewEmptyDataTemplate/CS/formviewemptydatatemplatecs.aspx#1)]
[!code-aspx-vb[FormViewEmptyDataTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewEmptyDataTemplate/VB/formviewemptydatatemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.ITemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataText" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.ItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerTemplate" />
</Docs>
</Member>
<Member MemberName="EmptyDataText">
<MemberSignature Language="C#" Value="public virtual string EmptyDataText { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string EmptyDataText" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.EmptyDataText" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property EmptyDataText As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ EmptyDataText { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.EmptyDataText : string with get, set" Usage="System.Web.UI.WebControls.FormView.EmptyDataText" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue("")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the text to display in the empty data row rendered when a <see cref="T:System.Web.UI.WebControls.FormView" /> control is bound to a data source that does not contain any records.</summary>
<value>The text to display in the empty data row. The default is an empty string (""), which indicates that this property is not set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The empty data row is displayed in a <xref:System.Web.UI.WebControls.FormView> control when the data source that is bound to the control does not contain any records. Use the <xref:System.Web.UI.WebControls.FormView.EmptyDataText%2A> property to specify the text to display in the empty data row. To control the style of the empty data row, use the <xref:System.Web.UI.WebControls.FormView.EmptyDataRowStyle%2A> property. Alternatively, you can define your own custom user interface (UI) for the empty data row by setting the <xref:System.Web.UI.WebControls.FormView.EmptyDataTemplate%2A> property instead of this property.
> [!NOTE]
> If both the <xref:System.Web.UI.WebControls.FormView.EmptyDataText%2A> and <xref:System.Web.UI.WebControls.FormView.EmptyDataTemplate%2A> properties are set, the <xref:System.Web.UI.WebControls.FormView.EmptyDataTemplate%2A> property takes precedence.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see <xref:System.ComponentModel.LocalizableAttribute> and [Globalization and Localization](https://msdn.microsoft.com/library/8ef3838e-9d05-4236-9dd0-ceecff9df80d).
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.EmptyDataText%2A> property to specify the text to display in the empty data row.
[!code-aspx-csharp[FormViewEmptyDataText#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewEmptyDataText/CS/formviewemptydatatextcs.aspx#1)]
[!code-aspx-vb[FormViewEmptyDataText#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewEmptyDataText/VB/formviewemptydatatextvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterText" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderText" />
</Docs>
</Member>
<Member MemberName="EnableModelValidation">
<MemberSignature Language="C#" Value="public virtual bool EnableModelValidation { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool EnableModelValidation" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.EnableModelValidation" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property EnableModelValidation As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property bool EnableModelValidation { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.EnableModelValidation : bool with get, set" Usage="System.Web.UI.WebControls.FormView.EnableModelValidation" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5">
<AttributeName>System.ComponentModel.DefaultValue(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value that indicates whether a validator control will handle exceptions that occur during insert or update operations.</summary>
<value>
<see langword="true" /> if a validator control will handle exceptions that occur during insert or update operations; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="EnsureDataBound">
<MemberSignature Language="C#" Value="protected override void EnsureDataBound ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void EnsureDataBound() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.EnsureDataBound" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub EnsureDataBound ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void EnsureDataBound();" />
<MemberSignature Language="F#" Value="override this.EnsureDataBound : unit -&gt; unit" Usage="formView.EnsureDataBound " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Makes certain that the <see cref="T:System.Web.UI.WebControls.FormView" /> control is bound to data when appropriate.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormView.EnsureDataBound%2A> method is a helper method used by the <xref:System.Web.UI.WebControls.FormView> class to make certain that the <xref:System.Web.UI.WebControls.FormView> control is bound to data when appropriate. The <xref:System.Web.UI.WebControls.FormView.EnsureDataBound%2A> method is usually called during the <xref:System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender%2A> method to bind the control to the data source when the data-bound control is not yet bound, but requires data binding. This version of the method has been overridden to prevent data binding from occurring when the <xref:System.Web.UI.WebControls.FormView> control is in insert mode.
]]></format>
</remarks>
<altmember cref="M:System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound" />
</Docs>
</Member>
<Member MemberName="ExtractRowValues">
<MemberSignature Language="C#" Value="protected virtual void ExtractRowValues (System.Collections.Specialized.IOrderedDictionary fieldValues, bool includeKeys);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void ExtractRowValues(class System.Collections.Specialized.IOrderedDictionary fieldValues, bool includeKeys) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.ExtractRowValues(System.Collections.Specialized.IOrderedDictionary,System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub ExtractRowValues (fieldValues As IOrderedDictionary, includeKeys As Boolean)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void ExtractRowValues(System::Collections::Specialized::IOrderedDictionary ^ fieldValues, bool includeKeys);" />
<MemberSignature Language="F#" Value="abstract member ExtractRowValues : System.Collections.Specialized.IOrderedDictionary * bool -&gt; unit&#xA;override this.ExtractRowValues : System.Collections.Specialized.IOrderedDictionary * bool -&gt; unit" Usage="formView.ExtractRowValues (fieldValues, includeKeys)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="fieldValues" Type="System.Collections.Specialized.IOrderedDictionary" />
<Parameter Name="includeKeys" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="fieldValues">An <see cref="T:System.Collections.Specialized.IOrderedDictionary" /> used to store the field values of the current data item.</param>
<param name="includeKeys">
<see langword="true" /> to include key fields; otherwise, <see langword="false" />.</param>
<summary>Retrieves the values of each field declared within the data row and stores them in the specified <see cref="T:System.Collections.Specialized.IOrderedDictionary" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormView.ExtractRowValues%2A> method is a helper method called by the <xref:System.Web.UI.WebControls.FormView> control to retrieve the values of each field declared within the data row. Because the data row displays a different template based on the current mode, this method retrieves only the field values declared in the template that corresponds to the current mode. The following table shows the available modes and the corresponding templates.
|Mode|Template|
|----------|--------------|
|Insert|<xref:System.Web.UI.WebControls.FormView.InsertItemTemplate%2A>|
|Edit|<xref:System.Web.UI.WebControls.FormView.EditItemTemplate%2A>|
|Read-only|<xref:System.Web.UI.WebControls.FormView.ItemTemplate%2A>|
You can specify whether the extracted values include the key field or fields by using the `includeKeys` parameter.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>When extending the <see cref="T:System.Web.UI.WebControls.FormView" /> class, you can override this method to create your own routine to retrieve the field values.</para>
</block>
<altmember cref="T:System.Collections.Specialized.IOrderedDictionary" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.ItemTemplate" />
<altmember cref="M:System.Web.UI.IBindableTemplate.ExtractValues(System.Web.UI.Control)" />
</Docs>
</Member>
<Member MemberName="FooterRow">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.WebControls.FormViewRow FooterRow { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.WebControls.FormViewRow FooterRow" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.FooterRow" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property FooterRow As FormViewRow" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::WebControls::FormViewRow ^ FooterRow { System::Web::UI::WebControls::FormViewRow ^ get(); };" />
<MemberSignature Language="F#" Value="member this.FooterRow : System.Web.UI.WebControls.FormViewRow" Usage="System.Web.UI.WebControls.FormView.FooterRow" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.FormViewRow</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the <see cref="T:System.Web.UI.WebControls.FormViewRow" /> object that represents the footer row in a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>A <see cref="T:System.Web.UI.WebControls.FormViewRow" /> that represents the footer row in a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The footer row is displayed at the bottom of the <xref:System.Web.UI.WebControls.FormView> control when the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> or <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property is set. Use the <xref:System.Web.UI.WebControls.FormView.FooterRow%2A> property to programmatically access the <xref:System.Web.UI.WebControls.FormViewRow> object that represents the footer row.
> [!NOTE]
> The <xref:System.Web.UI.WebControls.FormView.FooterRow%2A> property is available only after the <xref:System.Web.UI.WebControls.FormView> control creates the footer row in the <xref:System.Web.UI.WebControls.FormView.ItemCreated> event.
This property is commonly used when you need to programmatically manipulate the footer row, for example when adding custom content. Any modification to the <xref:System.Web.UI.WebControls.FormView.FooterRow%2A> property must be performed after the <xref:System.Web.UI.WebControls.FormView> control has been rendered; otherwise, the <xref:System.Web.UI.WebControls.FormView> control overwrites any changes.
To control the style of the footer row, use the <xref:System.Web.UI.WebControls.FormView.FooterStyle%2A> property.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.FooterRow%2A> property to programmatically modify the properties of the footer row during the <xref:System.Web.UI.WebControls.FormView.ItemCreated> event.
[!code-aspx-csharp[FormViewFooterTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewFooterTemplate/CS/formviewfootertemplatecs.aspx#1)]
[!code-aspx-vb[FormViewFooterTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewFooterTemplate/VB/formviewfootertemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterText" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderRow" />
<altmember cref="P:System.Web.UI.WebControls.FormView.BottomPagerRow" />
<altmember cref="P:System.Web.UI.WebControls.FormView.TopPagerRow" />
</Docs>
</Member>
<Member MemberName="FooterStyle">
<MemberSignature Language="C#" Value="public System.Web.UI.WebControls.TableItemStyle FooterStyle { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.WebControls.TableItemStyle FooterStyle" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.FooterStyle" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property FooterStyle As TableItemStyle" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Web::UI::WebControls::TableItemStyle ^ FooterStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };" />
<MemberSignature Language="F#" Value="member this.FooterStyle : System.Web.UI.WebControls.TableItemStyle" Usage="System.Web.UI.WebControls.FormView.FooterStyle" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.NotifyParentProperty(true)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.TableItemStyle</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a reference to the <see cref="T:System.Web.UI.WebControls.TableItemStyle" /> object that allows you to set the appearance of the footer row in a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>A reference to the <see cref="T:System.Web.UI.WebControls.TableItemStyle" /> that represents the style of the footer row in a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The footer row is displayed at the bottom of the <xref:System.Web.UI.WebControls.FormView> control when the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> or <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property is set. Use the <xref:System.Web.UI.WebControls.FormView.FooterStyle%2A> property to control the appearance of the footer row in a <xref:System.Web.UI.WebControls.FormView> control. This property is read-only; however, you can set the properties of the <xref:System.Web.UI.WebControls.TableItemStyle> object it returns. The properties can be set declaratively using one of the following methods:
- Place an attribute in the opening tag of the <xref:System.Web.UI.WebControls.FormView> control in the form `Property-Subproperty`, where `Subproperty` is a property of the <xref:System.Web.UI.WebControls.TableItemStyle> object (for example, `FooterStyle-ForeColor`).
- Nest a `<FooterStyle>` element between the opening and closing tags of the <xref:System.Web.UI.WebControls.FormView> control.
The properties can also be set programmatically in the form `Property.Subproperty` (for example, `FooterStyle.ForeColor`). Common settings usually include a custom background color, foreground color, and font properties.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.FooterStyle%2A> property to specify a custom style for the footer row.
[!code-aspx-csharp[FormViewFooterText#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewFooterText/CS/formviewfootertextcs.aspx#1)]
[!code-aspx-vb[FormViewFooterText#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewFooterText/VB/formviewfootertextvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.TableItemStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterText" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.RowStyle" />
</Docs>
</Member>
<Member MemberName="FooterTemplate">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.ITemplate FooterTemplate { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.ITemplate FooterTemplate" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.FooterTemplate" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property FooterTemplate As ITemplate" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::ITemplate ^ FooterTemplate { System::Web::UI::ITemplate ^ get(); void set(System::Web::UI::ITemplate ^ value); };" />
<MemberSignature Language="F#" Value="member this.FooterTemplate : System.Web.UI.ITemplate with get, set" Usage="System.Web.UI.WebControls.FormView.FooterTemplate" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.FormView))</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.ITemplate</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the user-defined content for the footer row in a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>A <see cref="T:System.Web.UI.ITemplate" /> that contains the custom content for the footer row. The default value is <see langword="null" />, which indicates that this property is not set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The footer row is displayed at the bottom of the <xref:System.Web.UI.WebControls.FormView> control when the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> or <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property is set. You can define your own custom user interface (UI) for the footer row by using the <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property. To specify a custom template for the footer row, first place `<FooterTemplate>` tags between the opening and closing tags of the <xref:System.Web.UI.WebControls.FormView> control. You can then list the contents of the template between the opening and closing `<FooterTemplate>` tags. To control the style of the footer row, use the <xref:System.Web.UI.WebControls.FormView.FooterStyle%2A> property. Alternatively, you can simply display text in the footer row by setting the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> property instead of this property.
> [!NOTE]
> If both the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> and <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> properties are set, the <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property takes precedence.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property to define a custom template to render for the footer row.
[!code-aspx-csharp[FormViewFooterTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewFooterTemplate/CS/formviewfootertemplatecs.aspx#1)]
[!code-aspx-vb[FormViewFooterTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewFooterTemplate/VB/formviewfootertemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.ITemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterText" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.ItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerTemplate" />
</Docs>
</Member>
<Member MemberName="FooterText">
<MemberSignature Language="C#" Value="public virtual string FooterText { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string FooterText" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.FooterText" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property FooterText As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ FooterText { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.FooterText : string with get, set" Usage="System.Web.UI.WebControls.FormView.FooterText" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue("")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the text to display in the footer row of a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>The text to display in the footer row. The default is an empty string (""), which indicates that this property is not set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The footer row is displayed at the bottom of the <xref:System.Web.UI.WebControls.FormView> control when the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> or <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property is set. Use the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> property to specify the text to display in the footer row. To control the style of the footer row, use the <xref:System.Web.UI.WebControls.FormView.FooterStyle%2A> property. Alternatively, you can define your own custom user interface (UI) for the footer row by setting the <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property instead of this property.
> [!NOTE]
> If both the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> and <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> properties are set, the <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property takes precedence.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see <xref:System.ComponentModel.LocalizableAttribute> and [Globalization and Localization](https://msdn.microsoft.com/library/8ef3838e-9d05-4236-9dd0-ceecff9df80d).
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> property to specify the text to display in the footer row.
[!code-aspx-csharp[FormViewFooterText#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewFooterText/CS/formviewfootertextcs.aspx#1)]
[!code-aspx-vb[FormViewFooterText#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewFooterText/VB/formviewfootertextvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataText" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderText" />
</Docs>
</Member>
<Member MemberName="GridLines">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.WebControls.GridLines GridLines { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Web.UI.WebControls.GridLines GridLines" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.GridLines" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property GridLines As GridLines" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::WebControls::GridLines GridLines { System::Web::UI::WebControls::GridLines get(); void set(System::Web::UI::WebControls::GridLines value); };" />
<MemberSignature Language="F#" Value="member this.GridLines : System.Web.UI.WebControls.GridLines with get, set" Usage="System.Web.UI.WebControls.FormView.GridLines" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(Mono.Cecil.CustomAttributeArgument)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.GridLines</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the gridline style for a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>One of the <see cref="T:System.Web.UI.WebControls.GridLines" /> values. The default is <see langword="GridLines.None" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.GridLines%2A> property to specify the gridline style for a <xref:System.Web.UI.WebControls.FormView> control. The following table lists the available styles.
|Style|Description|
|-----------|-----------------|
|`GridLines.None`|No gridlines are displayed.|
|`GridLines.Horizontal`|Displays the horizontal gridlines only.|
|`GridLines.Vertical`|Displays the vertical gridlines only.|
|`GridLines.Both`|Displays both the horizontal and vertical gridlines.|
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.GridLines%2A> property to display both the vertical and horizontal gridlines.
[!code-aspx-csharp[FormViewCellPadding#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewCellPadding/CS/formviewcellpaddingcs.aspx#1)]
[!code-aspx-vb[FormViewCellPadding#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewCellPadding/VB/formviewcellpaddingvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.GridLines" />
<altmember cref="P:System.Web.UI.WebControls.FormView.BackImageUrl" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CellPadding" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CellSpacing" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HorizontalAlign" />
</Docs>
</Member>
<Member MemberName="HeaderRow">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.WebControls.FormViewRow HeaderRow { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.WebControls.FormViewRow HeaderRow" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.HeaderRow" />
<MemberSignature Language="VB.NET" Value="Public Overridable ReadOnly Property HeaderRow As FormViewRow" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::WebControls::FormViewRow ^ HeaderRow { System::Web::UI::WebControls::FormViewRow ^ get(); };" />
<MemberSignature Language="F#" Value="member this.HeaderRow : System.Web.UI.WebControls.FormViewRow" Usage="System.Web.UI.WebControls.FormView.HeaderRow" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.FormViewRow</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the <see cref="T:System.Web.UI.WebControls.FormViewRow" /> object that represents the header row in a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>A <see cref="T:System.Web.UI.WebControls.FormViewRow" /> that represents the header row in a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The header row is displayed at the top of the <xref:System.Web.UI.WebControls.FormView> control when the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> or <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property is set. Use the <xref:System.Web.UI.WebControls.FormView.HeaderRow%2A> property to programmatically access the <xref:System.Web.UI.WebControls.FormViewRow> object that represents the header row.
> [!NOTE]
> The <xref:System.Web.UI.WebControls.FormView.HeaderRow%2A> property is available only after the <xref:System.Web.UI.WebControls.FormView> control creates the header row in the <xref:System.Web.UI.WebControls.FormView.ItemCreated> event.
This property is commonly used when you need to programmatically manipulate the header row, for example, when adding custom content. Any modification to the <xref:System.Web.UI.WebControls.FormView.HeaderRow%2A> property must be performed after the <xref:System.Web.UI.WebControls.FormView> control has been rendered; otherwise, the <xref:System.Web.UI.WebControls.FormView> control overwrites any changes.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.HeaderRow%2A> property to programmatically modify the properties of the header row during the <xref:System.Web.UI.WebControls.FormView.ItemCreated> event.
[!code-aspx-csharp[FormViewHeaderTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewHeaderTemplate/CS/formviewheadertemplatecs.aspx#1)]
[!code-aspx-vb[FormViewHeaderTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewHeaderTemplate/VB/formviewheadertemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderText" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterRow" />
<altmember cref="P:System.Web.UI.WebControls.FormView.BottomPagerRow" />
<altmember cref="P:System.Web.UI.WebControls.FormView.TopPagerRow" />
</Docs>
</Member>
<Member MemberName="HeaderStyle">
<MemberSignature Language="C#" Value="public System.Web.UI.WebControls.TableItemStyle HeaderStyle { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.WebControls.TableItemStyle HeaderStyle" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.HeaderStyle" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property HeaderStyle As TableItemStyle" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Web::UI::WebControls::TableItemStyle ^ HeaderStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };" />
<MemberSignature Language="F#" Value="member this.HeaderStyle : System.Web.UI.WebControls.TableItemStyle" Usage="System.Web.UI.WebControls.FormView.HeaderStyle" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.NotifyParentProperty(true)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.TableItemStyle</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a reference to the <see cref="T:System.Web.UI.WebControls.TableItemStyle" /> object that allows you to set the appearance of the header row in a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>A reference to the <see cref="T:System.Web.UI.WebControls.TableItemStyle" /> that represents the style of the header row in a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The header row is displayed at the top of the <xref:System.Web.UI.WebControls.FormView> control when the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> or <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property is set. Use the <xref:System.Web.UI.WebControls.FormView.HeaderStyle%2A> property to control the appearance of the header row in a <xref:System.Web.UI.WebControls.FormView> control. This property is read-only; however, you can set the properties of the <xref:System.Web.UI.WebControls.TableItemStyle> object it returns. The properties can be set declaratively using one of the following methods:
- Place an attribute in the opening tag of the <xref:System.Web.UI.WebControls.FormView> control in the form `Property-Subproperty`, where `Subproperty` is a property of the <xref:System.Web.UI.WebControls.TableItemStyle> object (for example, `HeaderStyle-ForeColor`).
- Nest a `<HeaderStyle>` element between the opening and closing tags of the <xref:System.Web.UI.WebControls.FormView> control.
The properties can also be set programmatically in the form `Property.Subproperty` (for example, `HeaderStyle.ForeColor`). Common settings usually include a custom background color, foreground color, and font properties.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.HeaderStyle%2A> property to specify a custom style for the header row.
[!code-aspx-csharp[FormViewHeaderText#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewHeaderText/CS/formviewheadertextcs.aspx#1)]
[!code-aspx-vb[FormViewHeaderText#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewHeaderText/VB/formviewheadertextvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.TableItemStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertRowStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.RowStyle" />
</Docs>
</Member>
<Member MemberName="HeaderTemplate">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.ITemplate HeaderTemplate { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.ITemplate HeaderTemplate" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.HeaderTemplate" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property HeaderTemplate As ITemplate" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::ITemplate ^ HeaderTemplate { System::Web::UI::ITemplate ^ get(); void set(System::Web::UI::ITemplate ^ value); };" />
<MemberSignature Language="F#" Value="member this.HeaderTemplate : System.Web.UI.ITemplate with get, set" Usage="System.Web.UI.WebControls.FormView.HeaderTemplate" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.FormView))</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.ITemplate</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the user-defined content for the header row in a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>A <see cref="T:System.Web.UI.ITemplate" /> that contains the custom content for the header row. The default value is <see langword="null" />, which indicates that this property is not set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The header row is displayed at the top of the <xref:System.Web.UI.WebControls.FormView> control when the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> or <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property is set. You can define your own custom user interface (UI) for the header row by using the <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property. To specify a custom template for the header row, first place `<HeaderTemplate>` tags between the opening and closing tags of the <xref:System.Web.UI.WebControls.FormView> control. You can then list the contents of the template between the opening and closing `<HeaderTemplate>` tags. To control the style of the header row, use the <xref:System.Web.UI.WebControls.FormView.HeaderStyle%2A> property. Alternatively, you can simply display text in the header row by setting the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> property instead of this property.
> [!NOTE]
> If both the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> and <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> properties are set, the <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property takes precedence.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property to define a custom template to render for the header row.
[!code-aspx-csharp[FormViewHeaderTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewHeaderTemplate/CS/formviewheadertemplatecs.aspx#1)]
[!code-aspx-vb[FormViewHeaderTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewHeaderTemplate/VB/formviewheadertemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.ITemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EditItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.ItemTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.PagerTemplate" />
</Docs>
</Member>
<Member MemberName="HeaderText">
<MemberSignature Language="C#" Value="public virtual string HeaderText { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string HeaderText" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.HeaderText" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property HeaderText As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::String ^ HeaderText { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.HeaderText : string with get, set" Usage="System.Web.UI.WebControls.FormView.HeaderText" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue("")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the text to display in the header row of a <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<value>The text to display in the header row. The default is an empty string (""), which indicates that this property is not set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The header row is displayed at the top of the <xref:System.Web.UI.WebControls.FormView> control when the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> or <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property is set. Use the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> property to specify the text to display in the header row. To control the style of the header row, use the <xref:System.Web.UI.WebControls.FormView.HeaderStyle%2A> property. Alternatively, you can define your own custom user interface (UI) for the header row by setting the <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property instead of this property.
> [!NOTE]
> If both the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> and <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> properties are set, the <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property takes precedence.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see <xref:System.ComponentModel.LocalizableAttribute> and [Globalization and Localization](https://msdn.microsoft.com/library/8ef3838e-9d05-4236-9dd0-ceecff9df80d).
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> property to specify the text to display in the header row.
[!code-aspx-csharp[FormViewHeaderText#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewHeaderText/CS/formviewheadertextcs.aspx#1)]
[!code-aspx-vb[FormViewHeaderText#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewHeaderText/VB/formviewheadertextvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderStyle" />
<altmember cref="P:System.Web.UI.WebControls.FormView.HeaderTemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.EmptyDataText" />
<altmember cref="P:System.Web.UI.WebControls.FormView.FooterText" />
</Docs>
</Member>
<Member MemberName="HorizontalAlign">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.WebControls.HorizontalAlign HorizontalAlign { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Web.UI.WebControls.HorizontalAlign HorizontalAlign" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.HorizontalAlign" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property HorizontalAlign As HorizontalAlign" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::WebControls::HorizontalAlign HorizontalAlign { System::Web::UI::WebControls::HorizontalAlign get(); void set(System::Web::UI::WebControls::HorizontalAlign value); };" />
<MemberSignature Language="F#" Value="member this.HorizontalAlign : System.Web.UI.WebControls.HorizontalAlign with get, set" Usage="System.Web.UI.WebControls.FormView.HorizontalAlign" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Category("Layout")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(Mono.Cecil.CustomAttributeArgument)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.WebControls.HorizontalAlign</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the horizontal alignment of a <see cref="T:System.Web.UI.WebControls.FormView" /> control on the page.</summary>
<value>One of the <see cref="T:System.Web.UI.WebControls.HorizontalAlign" /> values. The default is <see langword="HorizontalAlign.NotSet" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.WebControls.FormView.HorizontalAlign%2A> property to specify the horizontal alignment of a <xref:System.Web.UI.WebControls.FormView> control within the page. The following table lists the different horizontal alignment styles.
|HorizontalAlign value|Description|
|---------------------------|-----------------|
|`HorizontalAlign.NotSet`|The horizontal alignment of the <xref:System.Web.UI.WebControls.FormView> control has not been set.|
|`HorizontalAlign.Left`|The <xref:System.Web.UI.WebControls.FormView> control is left-aligned on the page.|
|`HorizontalAlign.Center`|The <xref:System.Web.UI.WebControls.FormView> control is centered on the page.|
|`HorizontalAlign.Right`|The <xref:System.Web.UI.WebControls.FormView> control is right-aligned on the page.|
|`HorizontalAlign.Justify`|The <xref:System.Web.UI.WebControls.FormView> control is aligned with both the left and right margins of the page.|
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.HorizontalAlign%2A> property to specify that a <xref:System.Web.UI.WebControls.FormView> control should be centered on the page.
[!code-aspx-csharp[FormViewHorizontalAlign#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewHorizontalAlign/CS/formviewhorizontalaligncs.aspx#1)]
[!code-aspx-vb[FormViewHorizontalAlign#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewHorizontalAlign/VB/formviewhorizontalalignvb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.HorizontalAlign" />
<altmember cref="P:System.Web.UI.WebControls.FormView.BackImageUrl" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CellPadding" />
<altmember cref="P:System.Web.UI.WebControls.FormView.CellSpacing" />
<altmember cref="P:System.Web.UI.WebControls.FormView.GridLines" />
</Docs>
</Member>
<Member MemberName="InitializePager">
<MemberSignature Language="C#" Value="protected virtual void InitializePager (System.Web.UI.WebControls.FormViewRow row, System.Web.UI.WebControls.PagedDataSource pagedDataSource);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void InitializePager(class System.Web.UI.WebControls.FormViewRow row, class System.Web.UI.WebControls.PagedDataSource pagedDataSource) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.InitializePager(System.Web.UI.WebControls.FormViewRow,System.Web.UI.WebControls.PagedDataSource)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void InitializePager(System::Web::UI::WebControls::FormViewRow ^ row, System::Web::UI::WebControls::PagedDataSource ^ pagedDataSource);" />
<MemberSignature Language="F#" Value="abstract member InitializePager : System.Web.UI.WebControls.FormViewRow * System.Web.UI.WebControls.PagedDataSource -&gt; unit&#xA;override this.InitializePager : System.Web.UI.WebControls.FormViewRow * System.Web.UI.WebControls.PagedDataSource -&gt; unit" Usage="formView.InitializePager (row, pagedDataSource)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="row" Type="System.Web.UI.WebControls.FormViewRow" />
<Parameter Name="pagedDataSource" Type="System.Web.UI.WebControls.PagedDataSource" />
</Parameters>
<Docs>
<param name="row">The <see cref="T:System.Web.UI.WebControls.FormViewRow" /> that contains the pager row.</param>
<param name="pagedDataSource">A <see cref="T:System.Web.UI.WebControls.PagedDataSource" /> that contains the data for the current page.</param>
<summary>Creates the pager row for the <see cref="T:System.Web.UI.WebControls.FormView" /> control.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormView.InitializePager%2A> method is a helper method called by the <xref:System.Web.UI.WebControls.FormView> control to create the pager row. It creates a <xref:System.Web.UI.WebControls.TableCell> object that contains the navigation controls using the properties of the <xref:System.Web.UI.WebControls.PagedDataSource> object contained in the `pagedDataSource` parameter. The cell is then added to the row specified by the `row` parameter.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>When extending the <see cref="T:System.Web.UI.WebControls.FormView" /> class, you can override this method to create your own pager row.</para>
</block>
<altmember cref="T:System.Web.UI.WebControls.FormViewRow" />
<altmember cref="T:System.Web.UI.WebControls.PagedDataSource" />
<altmember cref="T:System.Web.UI.WebControls.TableCell" />
<altmember cref="P:System.Web.UI.WebControls.FormView.AllowPaging" />
<altmember cref="M:System.Web.UI.WebControls.FormView.InitializeRow(System.Web.UI.WebControls.FormViewRow)" />
</Docs>
</Member>
<Member MemberName="InitializeRow">
<MemberSignature Language="C#" Value="protected virtual void InitializeRow (System.Web.UI.WebControls.FormViewRow row);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void InitializeRow(class System.Web.UI.WebControls.FormViewRow row) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.InitializeRow(System.Web.UI.WebControls.FormViewRow)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub InitializeRow (row As FormViewRow)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual void InitializeRow(System::Web::UI::WebControls::FormViewRow ^ row);" />
<MemberSignature Language="F#" Value="abstract member InitializeRow : System.Web.UI.WebControls.FormViewRow -&gt; unit&#xA;override this.InitializeRow : System.Web.UI.WebControls.FormViewRow -&gt; unit" Usage="formView.InitializeRow row" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="row" Type="System.Web.UI.WebControls.FormViewRow" />
</Parameters>
<Docs>
<param name="row">The <see cref="T:System.Web.UI.WebControls.FormViewRow" /> to initialize.</param>
<summary>Initializes the specified <see cref="T:System.Web.UI.WebControls.FormViewRow" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.FormView.InitializeRow%2A> method is a helper method called by the <xref:System.Web.UI.WebControls.FormView> control to initialize the specified <xref:System.Web.UI.WebControls.FormViewRow> object. The <xref:System.Web.UI.WebControls.FormViewRow> object is initialized based on the row type and row state specified by its <xref:System.Web.UI.WebControls.FormViewRow.RowType%2A> and <xref:System.Web.UI.WebControls.FormViewRow.RowState%2A> properties, respectively. The appropriate content is then added to the <xref:System.Web.UI.WebControls.FormViewRow> object. The following table describes how each row type is initialized.
|Row type|Description|
|--------------|-----------------|
|Data row|The contents of the <xref:System.Web.UI.WebControls.FormView.ItemTemplate%2A>, <xref:System.Web.UI.WebControls.FormView.EditItemTemplate%2A>, or <xref:System.Web.UI.WebControls.FormView.InsertItemTemplate%2A> property are added to the <xref:System.Web.UI.WebControls.FormViewRow> object, depending on the value of the <xref:System.Web.UI.WebControls.FormViewRow.RowState%2A> property.|
|Empty data row|The value of the <xref:System.Web.UI.WebControls.FormView.EmptyDataText%2A> property or the contents of the <xref:System.Web.UI.WebControls.FormView.EmptyDataTemplate%2A> property is added to the <xref:System.Web.UI.WebControls.FormViewRow> object, depending on which property is set. If both properties are set, the <xref:System.Web.UI.WebControls.FormView.EmptyDataTemplate%2A> property takes precedence.|
|Footer row|The value of the <xref:System.Web.UI.WebControls.FormView.FooterText%2A> property or the contents of the <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property is added to the <xref:System.Web.UI.WebControls.FormViewRow> object, depending on which property is set. If both properties are set, the <xref:System.Web.UI.WebControls.FormView.FooterTemplate%2A> property takes precedence.|
|Header row|The value of the <xref:System.Web.UI.WebControls.FormView.HeaderText%2A> property or the contents of the <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property is added to the <xref:System.Web.UI.WebControls.FormViewRow> object, depending on which property is set. If both properties are set, the <xref:System.Web.UI.WebControls.FormView.HeaderTemplate%2A> property takes precedence.|
> [!NOTE]
> This method does not initialize the pager row. To create the pager row, use the <xref:System.Web.UI.WebControls.FormView.InitializePager%2A> method.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>When extending the <see cref="T:System.Web.UI.WebControls.FormView" /> class, you can override this method to create your own custom row.</para>
</block>
<altmember cref="T:System.Web.UI.WebControls.FormViewRow" />
<altmember cref="T:System.Web.UI.WebControls.DataControlRowState" />
<altmember cref="T:System.Web.UI.WebControls.DataControlRowType" />
<altmember cref="M:System.Web.UI.WebControls.FormView.InitializePager(System.Web.UI.WebControls.FormViewRow,System.Web.UI.WebControls.PagedDataSource)" />
</Docs>
</Member>
<Member MemberName="InsertItem">
<MemberSignature Language="C#" Value="public virtual void InsertItem (bool causesValidation);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void InsertItem(bool causesValidation) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.FormView.InsertItem(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub InsertItem (causesValidation As Boolean)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual void InsertItem(bool causesValidation);" />
<MemberSignature Language="F#" Value="abstract member InsertItem : bool -&gt; unit&#xA;override this.InsertItem : bool -&gt; unit" Usage="formView.InsertItem causesValidation" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="causesValidation" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="causesValidation">
<see langword="true" /> to perform page validation when the method is called; otherwise, <see langword="false" />.</param>
<summary>Inserts the current record in the data source.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When the <xref:System.Web.UI.WebControls.FormView> control is in insert mode, use the <xref:System.Web.UI.WebControls.FormView.InsertItem%2A> method to programmatically insert the current record in the data source. This method is commonly used when you need to insert the current record from outside of the <xref:System.Web.UI.WebControls.FormView> control, such as from a different control on the page.
> [!NOTE]
> The <xref:System.Web.UI.WebControls.FormView> control must be in insert mode when this method is called; otherwise, an <xref:System.Web.HttpException> is thrown.
To specify whether page validation is performed before the insert operation, use the `causesValidation` parameter. Calling this method also raises the <xref:System.Web.UI.WebControls.FormView.ItemInserted> and <xref:System.Web.UI.WebControls.FormView.ItemInserting> events.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.FormView.InsertItem%2A> method to programmatically insert the current record in a <xref:System.Web.UI.WebControls.FormView> control in the data source.
[!code-aspx-csharp[FormViewInsertItem#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewInsertItem/CS/formviewinsertitemcs.aspx#1)]
[!code-aspx-vb[FormViewInsertItem#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewInsertItem/VB/formviewinsertitemvb.aspx#1)]
]]></format>
</remarks>
<exception cref="T:System.Web.HttpException">This method is called when the <see cref="T:System.Web.UI.WebControls.FormView" /> control is not in insert mode.
-or-
The <see cref="T:System.Web.UI.DataSourceView" /> object associated with the <see cref="T:System.Web.UI.WebControls.FormView" /> control is null.</exception>
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertItemTemplate" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemInserted" />
<altmember cref="E:System.Web.UI.WebControls.FormView.ItemInserting" />
<altmember cref="M:System.Web.UI.WebControls.FormView.DeleteItem" />
<altmember cref="M:System.Web.UI.WebControls.FormView.UpdateItem(System.Boolean)" />
</Docs>
</Member>
<Member MemberName="InsertItemTemplate">
<MemberSignature Language="C#" Value="public virtual System.Web.UI.ITemplate InsertItemTemplate { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.UI.ITemplate InsertItemTemplate" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.FormView.InsertItemTemplate" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property InsertItemTemplate As ITemplate" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Web::UI::ITemplate ^ InsertItemTemplate { System::Web::UI::ITemplate ^ get(); void set(System::Web::UI::ITemplate ^ value); };" />
<MemberSignature Language="F#" Value="member this.InsertItemTemplate : System.Web.UI.ITemplate with get, set" Usage="System.Web.UI.WebControls.FormView.InsertItemTemplate" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.FormView), System.ComponentModel.BindingDirection.TwoWay)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.UI.ITemplate</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the custom content for an item in insert mode.</summary>
<value>A <see cref="T:System.Web.UI.ITemplate" /> that contains the custom content for the data row when the <see cref="T:System.Web.UI.WebControls.FormView" /> control is in insert mode. The default value is null, which indicates that this property is not set.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref: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 <xref:System.Web.UI.WebControls.FormView.CurrentMode%2A> property). The following table shows which template is used for each mode.
|Mode|Template rendered|
|----------|-----------------------|
|Edit|<xref:System.Web.UI.WebControls.FormView.EditItemTemplate%2A>|
|Insert|<xref:System.Web.UI.WebControls.FormView.InsertItemTemplate%2A>|
|Read-only|<xref:System.Web.UI.WebControls.FormView.ItemTemplate%2A>|
Use the <xref:System.Web.UI.WebControls.FormView.InsertItemTemplate%2A> property to define your own user interface (UI) for the data row when the <xref: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 <xref: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 <xref: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 [Binding to Databases](https://msdn.microsoft.com/library/ab7b2846-975b-4057-a948-45527497c742). 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|
|-------------------------|-----------------------|
|Cancel|"Cancel"|
|Insert|"Insert"|
You can control the appearance of the item template by using the <xref:System.Web.UI.WebControls.FormView.InsertRowStyle%2A> property.
## Examples
The following example demonstrates how to define a custom template for a data row in insert mode.
[!code-aspx-csharp[FormViewInsertItemTemplate#1](~/samples/snippets/csharp/VS_Snippets_WebNet/FormViewInsertItemTemplate/CS/formviewinsertitemtemplatecs.aspx#1)]
[!code-aspx-vb[FormViewInsertItemTemplate#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/FormViewInsertItemTemplate/VB/formviewinsertitemtemplatevb.aspx#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.ITemplate" />
<altmember cref="P:System.Web.UI.WebControls.FormView.InsertRowStyle" />
<altmember cref=