RepositoryItemSearchLookUpEdit.AddNewValue Event
Fires when the “Add New” button is clicked, and allows you to add new records to the dropdown data source.
Namespace: DevExpress.XtraEditors.Repository
Assembly: DevExpress.XtraGrid.v24.2.dll
Declaration
Event Data
The AddNewValue event's data class is DevExpress.XtraEditors.Controls.AddNewValueEventArgs.
Remarks
You can display the “Add New” button in the editor’s dropdown by setting the RepositoryItemSearchLookUpEdit.ShowAddNewButton property to true.
Handle the AddNewValue event, which fires on clicking this button, to add a new record to the underlying data source (RepositoryItemLookUpEditBase.DataSource). After a record is created, set the e.Cancel parameter to false and assign the key value of the new record to the e.NewValue parameter. In this instance, the SearchLookUpEdit control will locate the new record and select it as the current record. This is accomplished by assigning the key value (a value of the RepositoryItemLookUpEditBase.ValueMember field) to the editor’s BaseEdit.EditValue property.
If you do not create a new record while handling the AddNewValue event, or if you do not need the SearchLookUpEdit control to locate the new record, set the e.Cancel parameter to true.