Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Fill Dropdown List box From Dataset

Fill Dropdown List box From Dataset

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Treacherous_1
    wrote on last edited by
    #1

    Does anyone know how to fill Dropdown list boxes from the dataset on form load? I really need some pointers, and in advance I appreciate the help. :doh: Treacherous_1

    J A 2 Replies Last reply
    0
    • T Treacherous_1

      Does anyone know how to fill Dropdown list boxes from the dataset on form load? I really need some pointers, and in advance I appreciate the help. :doh: Treacherous_1

      J Offline
      J Offline
      jasncab
      wrote on last edited by
      #2

      Sure I have a video out there that I made for my CIS 410 class. Let me know if you have problems seeing it. http://www.jasncab.com/devry/cis410 The idea is that you fill the dataset then bind to the Dim ds As DataSet Dim strSQL As String Dim strResult As String strSQL = "select rollid, rollid || '-' || description || ' ' || rolldate as descdate from qa_rollouts " 'FILL THE DATASET REMOVED _ ADD BACK IN cboRollouts.DataTextField = "descdate" cboRollouts.DataValueField = "rollid" cboRollouts.DataSource = ds cboRollouts.DataBind() ds.Dispose() ds = Nothing Really with anything in form load you want to make sure that you wrap your binding code inside of a ispostback. If you dont you will either overwrite what was there or add to it. Usually it isnt a good idea to leave the ispostback off. Also enabling viewstate has caused confusing depending on what you expect. http://www.jasncab.com/huberblog :: Jason Huber

      1 Reply Last reply
      0
      • T Treacherous_1

        Does anyone know how to fill Dropdown list boxes from the dataset on form load? I really need some pointers, and in advance I appreciate the help. :doh: Treacherous_1

        A Offline
        A Offline
        Anish Gopi
        wrote on last edited by
        #3

        ListBox1.DataTextField = "TextField" ListBox1.DataValueField = "ValueField" ListBox1.DataSource = dataset ListBox1.DataBind()

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups