kwilliams Posted April 6, 2010 Share Posted April 6, 2010 I need to populate a dropdownlist with a set of numbers that are looped (0 - 10). The code I have below works as a static option:Dim numbers() As String = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}...but I'd like to have a loop working something like thisDim n As Integer = 0For n = 0 To 10Response.Write(n)Next nDoes anyone know how to do this? Thanks. Link to comment Share on other sites More sharing options...
kwilliams Posted April 6, 2010 Author Share Posted April 6, 2010 Here's the solution:Dim n As IntegerFor n = 0 To 10 Dim listItem As New ListItem listItem.Text = n DropDownList1.Items.Add(listItem)NextThanks anyway:) Link to comment Share on other sites More sharing options...
sukhdev_ce Posted August 10, 2010 Share Posted August 10, 2010 Dim n As IntegerFor n = 0 To 10 DropDownList1.Items.Add(n.ToString())Nextits a simple solution of your problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.