|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Populate dropdown/listboxHi,
I have an LDAP query that I want to use to populate a dropdown/list box but when debugging the box seems to have the correct amount of entry in it but they are all: System.DirectoryServices.SearchResult. How can I get this to work? Code to retrieve groups beginning with Door (i.e. Door 1, Door 2, Door 3) Dim path as String = "LDAP://OU=InfraSec, DC=itsec, DC=ac, DC=uk" Dim searcher As DirectorySearcher = New DirectorySearcher(entry) Search.filter() = "(cn=Door*)" Dim result As SearchResult For Each result In searcher.FindAll() DoorList.Items.Add(result.ToString) Next When you used DoorList.Items.Add(result.ToString) you got a string
representation of the object type which is a SearchResult class Try modifying your code like this: 'assuming you wanted to bind the list to the "Email" searcher.PropertiesToLoad.Add("Email") Dim result As SearchResult For Each result In searcher.FindAll() DoorList.Items.Add(result.Properties("Email")(0).toString) Next Show quoteHide quote "Ed" wrote: > Hi, > I have an LDAP query that I want to use to populate a dropdown/list box > but when debugging the box seems to have the correct amount of entry in > it but they are all: System.DirectoryServices.SearchResult. How can I > get this to work? > > Code to retrieve groups beginning with Door (i.e. Door 1, Door 2, Door > 3) > > Dim path as String = "LDAP://OU=InfraSec, DC=itsec, DC=ac, DC=uk" > Dim searcher As DirectorySearcher = New DirectorySearcher(entry) > Search.filter() = "(cn=Door*)" > > Dim result As SearchResult > For Each result In searcher.FindAll() > DoorList.Items.Add(result.ToString) > Next > > >
Classic ASP String Manipulation - NOT .net
Server Side Custom Validation not running add a list item to a bound control Best way to have multiple pages show up as same selection on menu Programatically Databinding controls within a Repeater DataGrid Conditional Formatting Simple String Conversion? MaxLenth doesn't work My WebControls stopped working PostBackURL |
|||||||||||||||||||||||