Jump to content
kwilliams

Populate DropDownList With Looped Numbers?

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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:)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...