Hi,
Assume you have a class (say ClassA). ClassA inherits from another class (say ClassB) which contains property of DataRow (_data).
Now when the itemssource of RadGridView binds to ClassA and the user creates a new row, RadGridview will only create a new class of ClassA but it does not create the DataRow (_data) propery. How can I make the _data property is generated while creating a new row? thanks
Assume you have a class (say ClassA). ClassA inherits from another class (say ClassB) which contains property of DataRow (_data).
Now when the itemssource of RadGridView binds to ClassA and the user creates a new row, RadGridview will only create a new class of ClassA but it does not create the DataRow (_data) propery. How can I make the _data property is generated while creating a new row? thanks
public class ClassB: INotifyPropertyChanged { #region Data DataRow _data; [Browsable(false), Bindable(false)] public DataRow DataRow { get { return _data; } set { _data = value; OnPropertyChanged("DataRow"); } } #endregion // Data #region Constructors protected ClassB(DataRow data) : this() { _data = data; } protected ClassB() { } #endregion // Constructors public object GetField(string name) { object value = null; try { if (_data.Table.Columns.Contains(name)) { value = _data[name]; if (value is DBNull) value = null; } else value = null; } catch { } return value; } public void SetField(string name, object value) { try { if (_data.Table.Columns.Contains(name)) { _data[name] = (value == null) ? DBNull.Value : value; } } catch {} } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { if (this.PropertyChanged != null) this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } #endregion // INotifyPropertyChanged Members }