Version

AllowAddNew Property

Returns or sets a value that determines whether the user is allowed to add a new row of data and if so what kind of user interface is exposed for adding rows.
Syntax
'Declaration
 
Public Property AllowAddNew As AllowAddNew
public AllowAddNew AllowAddNew {get; set;}
Remarks

This property determines whether the user can add new rows to the data in the band or the grid controlled by the specified override. It also specifies the kind of user interface used for adding rows.

If using Yes, you must enable the AddNew box by setting the ultraGrid1.DisplayLayout.AddNewBox.Hidden to false. When the AddNew box is visible, this property also controls the appearance of the buttons in the AddNew box. If AllowAddNew is set to 2 (No) for a particular band, that band's button will be disabled in the AddNew box. This prevents the user from adding new data to the specified band.

TabRepeat provides for the rapid entry of new data. This value makes it possible to enter multiple rows of data efficiently using only the keyboard. When the user enters data in the last cell of the AddNew row, pressing the Tab key will automatically add a new row and position data input to the first cell of that row. TemplateOnBottom, TemplateOnTopWithTabRepeat, FixedOnBottom and FixedOnTop settings also facilitate rapid entry of new data using only the keyboard. See AllowAddNew enum for more information on all the options available.

Example
Following code sets various properties that control whether the user can modify data in the UltraGrid in various ways.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button31_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button31.Click

      ' There are three properties off the override that control whether modifying rows
      ' as well as adding and deleting rows are allowed. If you set these properties
      ' on the Override off the DisplayLayout, then these settings apply to the whole 
      ' UltraGrid.
      Me.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.True
      Me.ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.No
      Me.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False

      ' You can set them on a specific band as well. These settings override those
      ' set on the DisplayLayout's Override object for this band.
      Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowUpdate = DefaultableBoolean.True
      Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowAddNew = AllowAddNew.No
      Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowDelete = DefaultableBoolean.False

      ' There are Activation properties on row, column and cells that dictate whether 
      ' associated cells can be modified, or can even enter in edit mode.
      Dim column As UltraGridColumn = Me.ultraGrid1.DisplayLayout.Bands(0).Columns("CustomerID")
      Dim row As UltraGridRow = Me.ultraGrid1.Rows(0)

      ' Set the CellActivation off the column something other than AllowEdit to prevent
      ' the user from modifying cells in that column. ActivateOnly allows the user to 
      ' go into edit mode so the user can select and copy text, however the cell will
      ' be read-only thus preventing any data modification.
      column.CellActivation = Activation.ActivateOnly

      ' You can override cell activation setting for a particular row. 
      row.Activation = Activation.ActivateOnly

      ' Furthermore you can override activation on a cell as well.
      row.Cells(column).Activation = Activation.AllowEdit

  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button31_Click(object sender, System.EventArgs e)
{

	// There are three properties off the override that control whether modifying rows
	// as well as adding and deleting rows are allowed. If you set these properties
	// on the Override off the DisplayLayout, then these settings apply to the whole 
	// UltraGrid.
	this.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.True;
	this.ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.No;
	this.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False;

	// You can set them on a specific band as well. These settings override those
	// set on the DisplayLayout's Override object for this band.
	this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.True;
	this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowAddNew = AllowAddNew.No;
	this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowDelete = DefaultableBoolean.False;
	
	// There are Activation properties on row, column and cells that dictate whether 
	// associated cells can be modified, or can even enter in edit mode.
	UltraGridColumn column	= this.ultraGrid1.DisplayLayout.Bands[0].Columns["CustomerID"];
	UltraGridRow	row		= this.ultraGrid1.Rows[0];

	// Set the CellActivation off the column something other than AllowEdit to prevent
	// the user from modifying cells in that column. ActivateOnly allows the user to 
	// go into edit mode so the user can select and copy text, however the cell will
	// be read-only thus preventing any data modification.
	column.CellActivation = Activation.ActivateOnly;
	
	// You can override cell activation setting for a particular row. 
	row.Activation = Activation.ActivateOnly;

	// Furthermore you can override activation on a cell as well.
	row.Cells[column].Activation = Activation.AllowEdit;

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also