/// <include file='doc\DataRowView.uex' path='docs/doc[@for="DataRowView.this1"]/*' />
/// <devdoc>
/// <para>
/// Gets or sets a value in a specified column.
/// </para>
/// </devdoc>
public object this[string property] {
get {
if (dataView.Table.Columns.Contains(property))
{
return(row[property, dataView.IsOriginalVersion(this.index) ? DataRowVersion.Original : DataRowVersion.Default]);
}
else if (dataView.Table.DataSet != null && dataView.Table.DataSet.Relations.Contains(property))
{
return(dataView.CreateChildView(property, index));
}
throw ExceptionBuilder.PropertyNotFound(property, dataView.Table.TableName);
}
set {
if (!dataView.Table.Columns.Contains(property))
{
throw ExceptionBuilder.SetFailed(property);
}
if (!dataView.AllowEdit && (row != dataView.addNewRow))
{
throw ExceptionBuilder.CanNotEdit();
}
SetColumnValue(dataView.Table.Columns[property], value);
}
}