asp.net.ph

DetailsView.AutoGenerateEditButton Property

System.Web.UI.WebControls Namespace   DetailsView Class


.NET Framework version 2.0

Sets or retrieves a value specifying whether the built-in controls to edit a record are automatically added and displayed in a DetailsView control.

Syntax


Inline <asp:detailsview autogenerateeditbutton = true | false ... >
Script DetailsView.AutoGenerateEditButton [ = true | false ]

Property Value

This property accepts or returns only a boolean value: true if the built-in controls to edit a record are automatically added and displayed; otherwise, false. Default value is false.

Remarks

Use this property to specify whether the built-in controls to edit a record are automatically added and displayed in a DetailsView control.

Clicking the Edit button for a row puts the control into edit mode, and input controls are displayed for each field in the record, allowing the user to edit the values for the record. The Edit button for the record is replaced with an Update button and a Cancel button, and all other command buttons for the record are hidden. Clicking the Update button updates the record with the new values in the data source, whereas clicking the Cancel button cancels the operation.

Note that for the automatic update feature to work, the DetailsView must be bound to a data source control that is configured to update data, meaning the UpdateCommand must have been properly set.

In addition, the DataKeyNames property must be set to specify the key field or fields of the data source that will identify the record to edit.

The DetailsView control raises the following events to which you can assign a custom action to perform when a row is editd.

Event Description
ItemUpdated Occurs when the Edit button is clicked, but after the DetailsView control edits the record. This event is often used to check the results of the edit operation.
ItemUpdating Occurs when the Edit button is clicked, but before the DetailsView control updates the record. This event is often used to cancel the edit operation.
ModeChanged Occurs after the DetailsView control changes modes.
ModeChanging Occurs before the DetailsView control changes modes. This event is often used to cancel the mode change.

Example

The following example demonstrates how to use the AutoGenerateEditButton property to display the built-in controls to edit a record in a DetailsView control.

 Show me 

See Also

DetailsView Members   AutoGenerateDeleteButton   AutoGenerateInsertButton   Allowing Users to Edit Rows in a DetailsView Control Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph