
Kristjan Einarsson
Top achievements
Rank 1
Kristjan Einarsson
asked on 19 Jan 2011, 12:57 PM
Hi,
I'm trying to display the value in a cell when editing double values without displaying decimals, see screenshot -> the edit cell format seems to be overridden.
So my question is can I easily format the editable cell ?
All my GridViewDataColumn's have this dataformat:
col.DataFormatString = "{0:N0}";
Thanks
Kristján
I'm trying to display the value in a cell when editing double values without displaying decimals, see screenshot -> the edit cell format seems to be overridden.
So my question is can I easily format the editable cell ?
All my GridViewDataColumn's have this dataformat:
col.DataFormatString = "{0:N0}";
Thanks
Kristján
4 Answers, 1 is accepted
0
Accepted
Hello Kristjan Einarsson,
Kind regards,
Maya
the Telerik team
You may define the CellEditTemplate of the Column and set the StringFormat of the Binding:
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding StadiumCapacity}"
Header
=
"Stadium"
DataFormatString
=
"{}{0:N4}"
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
TextBox
Text
=
"{Binding StadiumCapacity, StringFormat=N0}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
Kind regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0

Kristjan Einarsson
Top achievements
Rank 1
answered on 20 Jan 2011, 09:50 AM
Thank you for your answer, it works like a charm for the columns that I know about, but I have some dynamic columns as well, I've been trying to do this in code behind without any success, is that possible to do that as well
Best regards
Kristján
Best regards
Kristján
0

Kristjan Einarsson
Top achievements
Rank 1
answered on 20 Jan 2011, 11:25 AM
Well I kinda found out
This seems to work, only the fraction is forgotten, but I think I can take care of the in BeginEdit.
cheers
kristján
FrameworkElementFactory text =
new
FrameworkElementFactory(
typeof
(TextBox));
text.SetBinding(TextBox.TextProperty,
new
Binding(
"Values["
+ i +
"].Value"
) { Mode = BindingMode.TwoWay, StringFormat=
"N0"
});
dt.VisualTree = text;
dt.Seal();
col.CellEditTemplate = dt;
This seems to work, only the fraction is forgotten, but I think I can take care of the in BeginEdit.
cheers
kristján
0
Hello Kristjan Einarsson,
Maya
the Telerik team
I am happy to see that you have found your solution out.
Let me know if you need any further assistance.
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>