Documentation for this section has not yet been entered.
The System.Web.UI.WebControls.FormView control renders a different template for the data row based on the current mode of the control (specified by the FormView.CurrentMode property). The following table shows which template is used for each mode.
Edit | |
Insert | |
Read-only |
Use the FormView.EditItemTemplate property to define your own user interface (UI) for the data row when the 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 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 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 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 ASP.NET Data Binding. 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.
Cancel |
"Cancel" |
Update |
"Update" |
You can control the appearance of the item template by using the FormView.EditRowStyle property.