Infragistics(R) NetAdvantage(R) Windows Forms
AllowAddNew Enumeration
Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : AllowAddNew Enumeration

Enum used for specifying the Override's UltraGridOverride.AllowAddNew property.

Syntax

Visual Basic (Declaration) 
Public Enum AllowAddNew 
   Inherits System.Enum
C# 
public enum AllowAddNew : System.Enum 

Members

MemberDescription
Default Use Default. The setting of the object's parent will be used.
FixedAddRowOnBottomFixed template add-row as the last row in rows-collections. FixedAddRowOnBottom option displays a fixed (non-scrolling) add-row in every rows-collection as the last row in the row collection. The user can use this template add-row to add a new row by simply typing into it.
FixedAddRowOnTopFixed template add-row as the first row in rows-collections. FixedAddRowOnTop option displays a fixed (non-scrolling) add-row in every rows-collection as the first row in the row collection. The user can use this template add-row to add a new row by simply typing into it.
No No. New Rows cannot be added by the user.
TabRepeat New Rows can be added by the user, and pressing the TAB key from within the last cell on an AddNew row will automatically add a new row.
TemplateOnBottomTemplate add-row as the last row in rows-collections. TemplateOnBottom option displays an add-row in every rows-collection as the last row in the row collection. The user can use this template add-row to add a new row by simply typing into it.
TemplateOnTopTemplate add-row as the first row in rows-collections. TemplateOnTop option displays an add-row in every rows-collection as the first row in the row collection. The user can use this template add-row to add a new row by simply typing into it.
TemplateOnTopWithTabRepeatSame as TemplateOnTop except with TemplateOnTopWithTabRepeat tabbing off an add-row will tab into the template-add row associated with the rows-collection and thus providing a convenient way adding multiple rows via keyboard.
Yes Yes. New Rows can be added by the user.

Example

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

Visual BasicCopy Code
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
C#Copy Code
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;

}

Remarks

The AllowAddNew enum is used for specifying the Override's UltraGridOverride.AllowAddNew property.

See Also