I have the following column defined inside of an XtraGrid. The column consists of dropdowns that force a user to choose one of 3 options. How can I wire an event that fires each time a user changes the value of a dropdown?
this.myCol.AppearanceCell.Options.UseTextOptions = true;
this.myCol.AppearanceCell.TextOptions.HAlignment =
DevExpress.Utils.HorzAlignment.Near;
this.myCol.Caption = "My Caption";
this.myCol.ColumnEdit = this._myRepositoryLookup;
this.myCol.FieldName = "MyFieldName";
this.myCol.Name = "myId";
this.myCol.Visible = true;
this.myCol.VisibleIndex = 5;
this.myCol.Width = 252;
You can subscribe to any RepositoryItemLookUpEdit Events, that you want to raise while working with these repository item controls.
For your requirement, you should use RepositoryItem.EditValueChanged Event, it Fires immediately after changing the edit value.
Note
The EditValueChangedFiringMode property is ignored for lookup editors during an incremental search while their popup windows are open. If the editor's edit value is changed during an incremental search, the EditValueChanged event fires immediately.
Code snippet:
_myRepositoryLookup.EditValueChanged += new EventHandler(_myRepositoryLookup_EditValueChanged);
this.myCol.AppearanceCell.Options.UseTextOptions = true;
this.myCol.AppearanceCell.TextOptions.HAlignment =
DevExpress.Utils.HorzAlignment.Near;
this.myCol.Caption = "My Caption";
this.myCol.ColumnEdit = this._myRepositoryLookup;
LookupEdit event handler method
void _myRepositoryLookup_EditValueChanged(object sender, EventArgs e)
{
//your code here
}
If you want to assign editors to individual cells then you can use GridView.CustomRowCellEdit Event
References that may help you:
DevExpress RepositoryItemLookUpEdit
Get Cell Control of GridView in DevExpress