/// <summary> /// Gets the zero-based index of the column that is bound /// to the specified <paramref name="dataField"/> property. /// </summary> /// <param name="dataField">The property name.</param> /// <param name="property">A reference to the <see cref="EntityProperty"/> object.</param> /// <returns>The column index.</returns> public int GetColumnIndex(String dataField, out EntityProperty property) { int index = -1; property = null; if ( !String.IsNullOrEmpty(dataField) ) { foreach ( EntityProperty prop in PropertyMappings ) { if ( dataField.Equals(prop.DataField) ) { index = prop.ColumnIndex; property = prop; break; } } } return index; }
/// <summary> /// Gets the <see cref="TableCell"/> object that is bound to /// the specified <paramref name="dataField"/> property. /// </summary> /// <param name="row">A <see cref="GridViewRow"/> object.</param> /// <param name="dataField">The property name.</param> /// <param name="property">a <see cref="EntityProperty"/> object.</param> /// <returns>A <see cref="TableCell"/> object.</returns> public TableCell GetCell(GridViewRow row, String dataField, out EntityProperty property) { TableCell cell = null; property = null; if ( row != null ) { int index = GetColumnIndex(dataField, out property); if ( index > -1 && index < row.Cells.Count ) { cell = row.Cells[index]; } } return cell; }