Reputation: 117
I need to display float numerics with symbol "+" or "-" before.
What is the correct string format?
For ex.
-1,5
-1
-0,5
0
+0,5
+1
settings.Columns.Add(column =>
{
column.FieldName = "current";
column.Caption = "Numeric";
column.ColumnType = MVCxGridViewColumnType.SpinEdit;
var edsettings = column.PropertiesEdit as DevExpress.Web.ASPxEditors.SpinEditProperties;
edsettings.DisplayFormatString = "0.#";
});
this is column of devexpress component grid in asp.mvc. where "current" is decimal value in Model
Upvotes: 0
Views: 4056
Reputation: 1331
Use the semicolon seperator to define different formats for positive and negative values, for example
string.Format("{0:+0.0;-0.0}", floatValue)
If you don't want to have a sign before a zero, then use a third option:
edsettings.DisplayFormatString = "+0.#;-0.#;0";
Ref: http://msdn.microsoft.com/en-us/library/0c899ak8.aspx#SectionSeparator
Upvotes: 5