I have the control below derived from a BoundField, used inside a GridView, as in the markup below the code. My problem is that the control renders the literal value of it's DataFormatString, not a formatted representation of it's data value.
public class BoundReportField : BoundField
{
public override string DataFormatString
{
get
{
var baseString = base.DataFormatString;
if (!string.IsNullOrWhiteSpace(baseString))
{
return FormatStrings.Currency;
}
return baseString;
}
set
{
base.DataFormatString = value;
}
}
protected override string FormatDataValue(object dataValue, bool encode)
{
var val = base.FormatDataValue(dataValue, encode);
return val;
}
}
<avm:BoundReportField DataField="BOND_AMOUNT" DataFormatString="R #\,###\,###" />
Try doing this in your markup:
DataFormatString="{0:R #\,###\,###}"
EDIT
Removed extra quote