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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:46:02+00:00 2026-05-24T13:46:02+00:00

I am developing a VB.NET ASPX file which is currently working. But now it

  • 0

I am developing a VB.NET ASPX file which is currently working. But now it errors cause I added this one new input parameter which is a dropdownlist. The dropdownlist works properly now. Its source comes from a SQL DataReader. But hte problem is that the fields that the user should see are different from underlying values. So I want to create a 2 dimensional array list or somehow create a mapping as follows:
Visible Text Invisible Value
AAAAA 601
BBBBB 602
CCCCC 603
…

So the user should just see AAAAA, BBBBB, CCCCC, etc. as choices. But then if they choose “BBBBB”, my SQL query must filter records on field = 602.

Here is excerpt of my code now:

        Dim pcSQL As String
        Dim ProductList As New ArrayList()
        Dim ProdCodeSearch As String
        Dim InstrumentSearch As String

        pcSQL = " select distinct instrument_name, product_code from FRUD.tblXref order by instrument_name "
        Dim DBConn As SqlConnection
        DBConn = New SqlConnection(ConfigurationManager.AppSettings("AMDMetricsConnectionString"))
        DBConn.Open()
        Dim reader As SqlDataReader
            Dim DBCommand As New SqlCommand(pcSQL, DBConn)       
        reader = DBCommand.ExecuteReader()

        While reader.Read()
        ProductList.Add(reader(0),reader(1))
        End While

        dProdCodeSearch.DataSource = ProductList(0)
        dProdCodeSearch.DataBind()
        reader.Close()

        ProdCodeSearch = dProdCodeSearch.SelectedValue
  • 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-24T13:46:03+00:00Added an answer on May 24, 2026 at 1:46 pm

    You have to set the DataTextField and the DataValueField of the DropDownList before you DataBind it.

    dProdCodeSearch.DataSource = reader
    dProdCodeSearch.DataTextField  = "instrument_name"
    dProdCodeSearch.DataValueField = "product_code"     
    dProdCodeSearch.DataBind()
    

    The DataTextField is the column that you want the user to see and the DataValueField normally is the primary-key column.

    You need the DropDownList’s SelectedValue to get the identifier of the selected item.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'me currently developing a silverlight application. In this application, I've an exception handler which
I am currently developing an ASP.net c# application. I have a grid view which
I am developing a VB.NET ASPX file and am trying to run a string
I am developing a VB.NET ASPX file in VS 2008. I am having trouble
When developing with .NET 3.5 I naturally use LINQ for data access. But for
I am developing an .net application which heavely depends on plugins. The application itself
I'm working with C#.net developing applications for windows mobile 6, and i need get
I am developing an application using asp.net 2.0 (C#), in which I am trying
I am developing a C#/SQL ASP.NET web application in VS 2008. Currently I am
I'm developing some CRUD screens for retrieving/updating various items using .NET 3.5 and aspx

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.