P
Piotr
Hi
I'm working with Datagrid containg decimal (editable) numbers. The
user-entered numbers are read by decimal.Parse() method. However, Datagrid
formats some decimals as "1", but some as (eg) "1.00" - depends on what the
user had entered. The page has DISABLED viewstate.
So, let someone explain me why the number 1 is not the same as 1.0 or 1.000?
I cannot find any property to set the precision.
The number of decimal digits can be different in different rows, so no
static format option can be used. Currently the only option to get correct
formatting is (a bit stupid) construction like this:
((decimal)DataBinder.Eval(Container.DataItem, "Quantity")).ToString("F" +
((int)DataBinder.Eval(Container.DataItem, "DecimalPlaces")).ToString()
Regards.
I'm working with Datagrid containg decimal (editable) numbers. The
user-entered numbers are read by decimal.Parse() method. However, Datagrid
formats some decimals as "1", but some as (eg) "1.00" - depends on what the
user had entered. The page has DISABLED viewstate.
So, let someone explain me why the number 1 is not the same as 1.0 or 1.000?
I cannot find any property to set the precision.
The number of decimal digits can be different in different rows, so no
static format option can be used. Currently the only option to get correct
formatting is (a bit stupid) construction like this:
((decimal)DataBinder.Eval(Container.DataItem, "Quantity")).ToString("F" +
((int)DataBinder.Eval(Container.DataItem, "DecimalPlaces")).ToString()
Regards.