Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9250593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:28:44+00:00 2026-06-18T10:28:44+00:00

we can make dropdown list in asp.net component with below syntax <asp:DropDownList ID=test runat=server>

  • 0

we can make dropdown list in asp.net component with below syntax

 <asp:DropDownList ID="test" runat="server">
      <asp:ListItem Text="1" Value="1"></asp:ListItem>
 </asp:DropDownList>

if we want our combo box contain 1 to 1000 , is there any way to populate it with foreach loop , rather than manually add 1000 item to it ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:28:46+00:00Added an answer on June 18, 2026 at 10:28 am

    Yes, you can add ListItems programmatically:

    for(int i=1; i<=1000; i++)
    {
        ListItem item = new ListItem(i.ToString(), i.ToString());
        test.Items.Add(item);
    }
    

    ListItemCollection.Add

    You could also use this linq query and use it as DataSource:

    var source = Enumerable.Range(1, 1000)
        .Select(i => new { Text= i.ToString(), Value=i.ToString() });
    test.DataSource = source;
    test.DataTextField = "Text";
    test.DataValueField = "Value";
    test.DataBind();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to ASP.NET and have been trying to make the dropdownlist works
I need to customize dropdownlist in asp.net and add checkboxes to make it a
How to make a dynamic dropdownlist on asp.net? I have a dropdownlist : <asp:DropDownList
<tr runat=server > <th><%= Resources.bicweb_resources.BORDER_STYLE %></th> <td> <asp:DropDownList runat=server id = borderContent class =
I'm experimenting with ASP.NET MVC3 and want to simply populate a dropdown list with
I know in ASP.NET I can get an item from a DropDownList by using
Anyone know of a control for asp.net that can achieve this either server or
is there a way to make the datatextfield property of a dropdownlist in asp.net
how can i make a drop down list on android ?i google it and
I want to make a drop-down list from scratch. Can anyone please tell me

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.