Пример #1
0
        protected override void SetColumnValueAtRow(CurrencyManager source, int rowNum, object value)
        {
            int intCount;
            DataGridCheckErrorCellEventArgs e = null;

            if (DataGridCheckErrorCell != null)
            {
                e = new DataGridCheckErrorCellEventArgs(rowNum, value, _HasError.ContainsKey(rowNum));
                DataGridCheckErrorCell(this, e);
                if (e.CellError)
                {
                    setErrorCell(rowNum, e.ErrorMessage);
                }
                else
                {
                    clearErrorCell(rowNum);
                }
            }
            intCount = (DataGridTableStyle.DataGrid.DataSource as DataTable).Rows.Count;
            if (intCount < rowNum + 1)
            {
                DataRow dr = (DataGridTableStyle.DataGrid.DataSource as DataTable).NewRow();
                (DataGridTableStyle.DataGrid.DataSource as DataTable).Rows.Add(dr);
            }

            base.SetColumnValueAtRow(source, rowNum, e != null? e.Value : value);
            //base.SetColumnValueAtRow (source, rowNum, value);
        }
        protected override void SetColumnValueAtRow(CurrencyManager source, int rowNum, object value)
        {
            int intCount;
            DataGridCheckErrorCellEventArgs e = null;
            if(DataGridCheckErrorCell != null)
            {
                e = new DataGridCheckErrorCellEventArgs(rowNum,value,_HasError.ContainsKey(rowNum));
                DataGridCheckErrorCell(this,e);
                if(e.CellError)
                    setErrorCell(rowNum,e.ErrorMessage);
                else
                    clearErrorCell(rowNum);
            }
            intCount = (DataGridTableStyle.DataGrid.DataSource as DataTable).Rows.Count;
            if(intCount < rowNum + 1)
            {
                DataRow dr = (DataGridTableStyle.DataGrid.DataSource as DataTable).NewRow();
                (DataGridTableStyle.DataGrid.DataSource as DataTable).Rows.Add(dr);
            }

            base.SetColumnValueAtRow (source, rowNum, e != null? e.Value : value);
            //base.SetColumnValueAtRow (source, rowNum, value);
        }