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

  • SEARCH
  • Home
  • 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 272261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:17:19+00:00 2026-05-12T00:17:19+00:00

Im iterating a list and getting hold of 2 fields Name and Url i

  • 0

Im iterating a list and getting hold of 2 fields “Name” and “Url”

i want to extract these fields and use them to create a datasource

I want to databind these to a dropdownList

DropDownList.DataTextField = "Name";
DropDownList.DataValueField = "Url";

how can I create a datasource based on this list?
then do the above, then databind.

  • 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-05-12T00:17:20+00:00Added an answer on May 12, 2026 at 12:17 am

    Assuming that you have an list item named MyListItem and MyListItem has two properties Name and Url, you can bind a list of MyListItem like that :

    List<MyListItem> dataSource = new List<MyListItem>();
    
    MyListItem item1 = new MyListItem();
    item1.Name = "Name 1";
    item1.Url = "Url 1";
    dataSource.Add(item1);
    
    MyListItem item2 = new MyListItem();
    item2.Name = "Name 2";
    item2.Url = "Url 2";
    dataSource.Add(item2);
    
    dropDownList.DataSource = dataSource;
    dropDownList.DataTextField = "Name";
    dropDownList.DataValueField = "Url";
    dropDownList.DataBind();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting a UserList by following List<User> UserList=usersService.findUsers(); than am iterating over this
I am using CoreService2010Client , I am iterating through a list of TCM ID
Can you remove an item from a List<> whilst iterating through it? Will this
I want to do the below list iteration in django templates: foo = ['foo',
I have 10 form fields and I want to append a number next to
I am running into this weird issue where I am iterating over a list
I have a list of tasks. A task is defined by a name, a
I have a List of 2D points. What's an efficient way of iterating through
I'm occasionally getting a ConcurrentModificationException when I iterate over a list. A Google search
I am trying to use an Array instead of a list in my query.

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.