what i have as referencexmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
<telerik:GridViewDataColumn Header="Amount Paid" Width="150" IsReadOnly="True" IsGroupable="false" IsFilterable="True"
DataMemberBinding="{Binding AmountPaid}" DataFormatString="{}{0:C2}"/>
<telerik:GridViewDataColumn>
What i get in the gridview is attached as a screen capture NOTE that AmountPaid is object of type of string
does that matter???
4 Answers, 1 is accepted
{0:C} applies only if the backing property's type is a numeric one - Integer, Double, Float, etc. You can either create another property on your data object that returns the string value converted as a double, or you can use a BindingConverter to perform the conversion in your binding.
Regards,
Yavor Georgiev
the Telerik team
I'm use DataFormatString for a column with type Money, but it doesn't work:
<telerikGridView:GridViewDataColumn TextAlignment="Right"
DataMemberBinding="{Binding UnitPrice,Mode=TwoWay}"
HeaderTextAlignment="Center"
Header="{Binding GlobalResource.INUnitPrice, Source={StaticResource MISAResource}}"
Width="110"
DataFormatString="{}{0:c1}"
>
<telerikGridView:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<MyLib:RadMaskedTextBox
Value="{Binding UnitPrice,Mode=TwoWay}"/>
</DataTemplate>
</telerikGridView:GridViewDataColumn.CellEditTemplate>
</telerikGridView:GridViewDataColumn>
Database:
ColumnName Data Type Allows Null
UnitPrice money Unchecked
Thanks alot
May you provide a bit more details what is the behavior you expect and what is the one you get ?
Based on the settings you are using, the currency mask will be applied only in view-mode, while in edit-mode you will see only the digits. If you want to display the currency in edit-mode too, you have to define the Mask property of the RadMaskedTextBox in the CellEditTemplate:
<
telerik:GridViewDataColumn
TextAlignment
=
"Right"
DataMemberBinding
=
"{Binding UnitPrice,Mode=TwoWay}"
HeaderTextAlignment
=
"Center"
Width
=
"110"
DataFormatString
=
"{}{0:c1}"
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
telerik:RadMaskedTextBox
Value
=
"{Binding UnitPrice,Mode=TwoWay}"
MaskType
=
"Numeric"
Mask
=
"c1"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
Greetings,
Maya
the Telerik team
I am using RAD GridView.I am pulling data from database and binding it to the gridview.For one column i need to divide by 60(to convert from seconds to minutes).The original source should be seconds as remaining manipulation will according to seconds.While displaying in the grid it should be in minutes.How can I do that??
Thanks in advance.