A simple query , i want to populate the dropdownlist with number starting from 17 to 90 , and the last number should be a string like 90+ instead of 90. I guess the logic will be using a for loop something like:
for (int a = 17; a <= 90; a++)
{
ddlAge.Items.Add(a.ToString());
}
Also I want to populate the text and value of each list item with the same numbers. Any ideas?
for (int i = 17; i < 90; i++)
{
ddlAge.Items.Add(new ListItem(i.ToString(), i.ToString()));
}
ddlAge.Items.Add(new ListItem("90+", "90"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With