■ UltraGrid 클래스에서 IDataErrorInfo 인터페이스를 사용해 행/셀 에러를 표시하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
using System; using System.Data; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; private UltraGrid ultraGrid; ... this.ultraGrid.DisplayLayout.Override.SupportDataErrorInfo = SupportDataErrorInfo.RowsAndCells; this.ultraGrid.DisplayLayout.Bands[0].Columns[0].SupportDataErrorInfo = DefaultableBoolean.False; this.ultraGrid.DisplayLayout.Override.DataErrorRowSelectorAppearance.BackColor = Color.Red; this.ultraGrid.DisplayLayout.Override.DataErrorRowAppearance.BackColor = Color.LightYellow; this.ultraGrid.DisplayLayout.Override.DataErrorCellAppearance.BackColor = Color.Red; ... #region UltraGrid 행 초기화 하기 - ultraGrid_InitializeRow(sender, e) /// <summary> /// UltraGrid 행 초기화 하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void ultraGrid_InitializeRow(object sender, InitializeRowEventArgs e) { string rowError = string.Empty; string cellError = string.Empty; if(e.Row.Cells["Fax"].Value == DBNull.Value) { rowError = "Row contains errors."; cellError = "Fax can not be empty"; } DataRowView dataRowView = e.Row.ListObject as DataRowView; dataRowView.Row.RowError = rowError; dataRowView.Row.SetColumnError("Fax", cellError); } #endregion |