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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

selected index row color 4
GridView 1
Update Panel and Event 2
Filter Records 5
Add row to GridView 1
DataSource. Please, need some help. 1
Binding Objects 1
Hide when Empty. How to do this? 1

Back
Top