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. DropDownList.SelectedItem.Text returning Null

DropDownList.SelectedItem.Text returning Null

Scheduled Pinned Locked Moved ASP.NET
helpquestion
3 Posts 2 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.
  • N Offline
    N Offline
    Norriskilla
    wrote on last edited by
    #1

    I am populating a drop down list from AD, which is working fine (The drop downlist is populated when I browse to the site.) The problem I am having is that when I later go to use that data with dropdownlist.SelectedItem.Text, nothing is returned. Any suggestions? Dim Groups1 As New DirectorySearcher Dim GroupSearchRoot1 As New DirectoryEntry("LDAP://OU=SomeOU,OU=SomeOU,OU=SomeOU,DC=SomeDomain,DC=SomeTopLevelDomain") With Groups1 .SearchRoot = GroupSearchRoot .Filter = "(&(ObjectClass=Group)(CN=SomeGroup))" End With Dim Members1 As Object = Groups1.FindOne.GetDirectoryEntry.Invoke("Members", Nothing) For Each Member As Object In CType(Members1, IEnumerable) Dim CurrentMember1 As New DirectoryEntry(Member) dropdownlist.Items.Add(CurrentMember1.Name.Remove(0, 3)) Some code to sort the dropdownlist alphabetically...

    C 1 Reply Last reply
    0
    • N Norriskilla

      I am populating a drop down list from AD, which is working fine (The drop downlist is populated when I browse to the site.) The problem I am having is that when I later go to use that data with dropdownlist.SelectedItem.Text, nothing is returned. Any suggestions? Dim Groups1 As New DirectorySearcher Dim GroupSearchRoot1 As New DirectoryEntry("LDAP://OU=SomeOU,OU=SomeOU,OU=SomeOU,DC=SomeDomain,DC=SomeTopLevelDomain") With Groups1 .SearchRoot = GroupSearchRoot .Filter = "(&(ObjectClass=Group)(CN=SomeGroup))" End With Dim Members1 As Object = Groups1.FindOne.GetDirectoryEntry.Invoke("Members", Nothing) For Each Member As Object In CType(Members1, IEnumerable) Dim CurrentMember1 As New DirectoryEntry(Member) dropdownlist.Items.Add(CurrentMember1.Name.Remove(0, 3)) Some code to sort the dropdownlist alphabetically...

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      This looks messy and complicated. I also don't see any code to stop it running every postback, or any indication where it runs. If you run this code in page load, it resets the data source, and thus will cause the selection to be lost.

      Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

      N 1 Reply Last reply
      0
      • C Christian Graus

        This looks messy and complicated. I also don't see any code to stop it running every postback, or any indication where it runs. If you run this code in page load, it resets the data source, and thus will cause the selection to be lost.

        Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

        N Offline
        N Offline
        Norriskilla
        wrote on last edited by
        #3

        The site is simply a one page form with a submit button, basically a web form for employees to use for new user requests. On submit a specifically crafted email is sent to our ticketing system creating a ticket for the various IT groups involved in New User setups. The ticketing system sends an email to an "Authorized Manager" asking for approval for the request. The drop down list is a list of Authorized Managers. Currently the site is in prod, with a hard coded list of Authorized Managers, I am trying to improve it by using AD Security groups so that I don't have to manually maintain the list. Should I ditch the above code and try something else, or is there some way that I can salvage it? I am just a script monkey Sys Admin trying his hand at "actual" prgramming to improve process.

        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