.NET Framework Class Library
DetailsView..::.InsertItem Method

Inserts the current record in the data source.

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

Visual Basic (Declaration)
Public Overridable Sub InsertItem ( _
    causesValidation As Boolean _
)
Visual Basic (Usage)
Dim instance As DetailsView
Dim causesValidation As Boolean

instance.InsertItem(causesValidation)
C#
public virtual void InsertItem(
    bool causesValidation
)
Visual C++
public:
virtual void InsertItem(
    bool causesValidation
)
JScript
public function InsertItem(
    causesValidation : boolean
)

Parameters

causesValidation
Type: System..::.Boolean
true to perform page validation when the method is called; otherwise, false.
Exceptions

ExceptionCondition
HttpException

This method is called when the DetailsView control is not in insert mode.

- or -

The DataSourceView associated with the DetailsView control is nullNothingnullptra null reference (Nothing in Visual Basic).

Remarks

When the DetailsView control is in insert mode, use the InsertItem 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 DetailsView control, such as from a different control on the page.

NoteNote:

The DetailsView control must be in insert mode when this method is called; otherwise, an HttpException exception is thrown.

To specify whether page validation is performed before the insert operation, use the causesValidation parameter. Calling this method also raises the ItemInserted and ItemInserting events.

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0, 2.0
See Also

Reference

Tags :


Page view tracker