asp.net.ph

CommandField.ShowInsertButton Property

System.Web.UI.WebControls Namespace   CommandField Class


.NET Framework version 2.0

Sets or retrieves a value indicating whether a New button is displayed in a CommandField.

Syntax


Inline <asp:commandfield showinsertbutton = true | false ... >
Script CommandField.ShowInsertButton [ = true | false ]

Property Value

This property accepts or returns only a boolean value: true to display a New button in a CommandField; otherwise, false. Default value is false.

Remarks

Use the ShowInsertButton property to specify whether a New button is displayed for each data row in a CommandField control.

NOTE: This property applies only to data-bound controls that support insert operations, such as the DetailsView control.

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

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

When the ButtonType property of a CommandField is set to Button or Link, use the InsertText property to specify the text to display for an Insert button.

Alternatively, you can display an image by first setting the ButtonType property to Image and then setting the InsertImageUrl property.

Example

The following example demonstrates how to use the ShowInsertButton property to display a New button in a DetailsView control.

 Show me 

See Also

CommandField Members   ShowCancelButton   ShowDeleteButton   ShowEditButton   ShowSelectButton 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