vinnie wrote:
When i try to populate a dropdownlist menu, using a for cicle works
perfect: i get a list of int from ie 1 to 10. How an populate my
ddlist if working on the code i wish to get not longer a series of
integers, but a series of decimals?
Like this:
old fashion: (for i=1; i<=100; i++) i get 100 integers;
New fashion) i want to populate the same list, but using the decimals:
1; 1.01; 1.02; 1.03.... 99.99, 100.00
That's a lot of items. :)
Is it possible?
Anything is possible. :)
In your specific example, you appear to be incrementing your counter by
hundredths. So, you might use a loop like this:
for (decimal num = 1.0; num <= 100.0; num += 0.01)
{
// code to add to list here
}
You could also use floats, but I think the decimal type might work
better for your situation.
For that matter, you could use an integer, going from 100 to 10000,
where you divide by 100 when adding the value to the list.
Pete