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 3301984
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:48:21+00:00 2026-05-17T20:48:21+00:00

I have a State class defined like this: Public Class State Public Property StateId

  • 0

I have a State class defined like this:

Public Class State
    Public Property StateId As Integer
    Public Property Name As Dictionary(Of Integer, String)
End Class

Name(x) contains the state name in different languages.

I get a collection of State from the method StateManager.GetAllStates()
and I want to bind this collection to a DropDownList. The problem is that
I can’t find how to set the DataTextField property to let’s say stateList.Name(1)
which is the english name of my state.

Dim stateList As StateCollection = StateManager.GetAllStates() 

Me.DataSource = stateList
Me.DataValueField = "StateId"
Me.DataTextField = "Name(1).Value" <-- Problem here
Me.DataBind()

Anyone have an idea?

Thanks

  • 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-17T20:48:22+00:00Added an answer on May 17, 2026 at 8:48 pm

    When you use a data source, you can’t use complex expressions to specify values.

    Create a source where you extact the values that you need:

    Me.DataSource = stateList.Select( _
      Function(s as State) New With { .Id = s.StateId, .Name = s.Name(1) } _
    );
    Me.DataValueField = "Id"
    Me.DataTextField = "Name"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, let's say we have a class defined like public class TestClass { private
I have a few properties defined in my header file like so @property (assign)
I am using asp.net MVC2. I have a model defined as public class Department
Say I have defined a variable like this (C++): static const char str[] =
I have a module that looks something like this: def __myFunc(): ... class MyClass(object):
I have a div with the following CSS class defined: <div class=ui-button ui-state-active>bla bla
I have an Order class which goes through a series of defined states. To
I have a simple question about .net delegates. Say I have something like this:
Basically I have the following class: class StateMachine { ... StateMethod stateA(); StateMethod stateB();
I have heard people state that Code Generators and T4 templates should not be

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.