You can create your own implementation of DataGridViewTextBoxCell and override the GetFormattedValue method. Here you can return the formatted value for your column below:
// use custom DataGridViewTextBoxCell as columns template
col.CellTemplate = new MyDataGridViewTextBoxCell();
...
public class MyDataGridViewTextBoxCell : DataGridViewTextBoxCell
{
protected override Object GetFormattedValue(Object value,
int rowIndex,
ref DataGridViewCellStyle cellStyle,
TypeConverter valueTypeConverter,
TypeConverter formattedValueTypeConverter,
DataGridViewDataErrorContexts context)
{
return String.Format("{0} per {1}",
this.DataGridView.Rows[rowIndex].Cells[0].Value,
this.DataGridView.Rows[rowIndex].Cells[1].Value);
}
}
hope this helps, believes
source
share