Number

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

Inside a GridView I am accessing a value of the datasource:

DataBinder.Eval(gvrContainer.DataItem, "Average")

I know this is of type Double. I want to round it and change it to
integer.

How can i do this?

Thanks,

Miguel
 
Hello,

Inside a GridView I am accessing a value of the datasource:

DataBinder.Eval(gvrContainer.DataItem, "Average")

I know this is of type Double. I want to round it and change it to
integer.

How can i do this?

Thanks,

Miguel

Math.Round(gvrContainer.DataItem, "Average"),0)
 
Hello,

Inside a GridView I am accessing a value of the datasource:

DataBinder.Eval(gvrContainer.DataItem, "Average")

I know this is of type Double. I want to round it and change it to
integer.

How can i do this?

Thanks,

Miguel

Try
System.Math.Floor(value); //for rounding down
and
System.Math.Ceiling(value); //for rounding up

Regards
Dariusz Tarczynski
 
Back
Top