Can anyone please give me a sample of how to use the control toolkit combobox, to display a list of OU's from active directory. which can then be selected to use in object creation.
I've been trying for hours, and i have managed to get the combobox to display all the current ou's. but selecting any of them and then doing a postback, returns no item selected.
Below is the bit of code i had been using for generating the ou list, can you tell me how to properly pass this list to a combobox.
Are you only populating the ListBox if !IsPostBack (If Not IsPostback in VB)? If you bind the ListBox again in Page_Load after a postback (which is what it sounds like you are doing), it will overwrite the selection before calling your ListBox_Selected
event.
Darrell Norton, MVP
Darrell Norton's Blog Please click "Mark as Answer" if this helped you.
Spyderco
Member
5 Points
9 Posts
ComboBox driving me crazy
Feb 15, 2012 09:27 AM|LINK
Hi,
Can anyone please give me a sample of how to use the control toolkit combobox, to display a list of OU's from active directory. which can then be selected to use in object creation.
I've been trying for hours, and i have managed to get the combobox to display all the current ou's. but selecting any of them and then doing a postback, returns no item selected.
Below is the bit of code i had been using for generating the ou list, can you tell me how to properly pass this list to a combobox.
public static List<DirectoryEntry> Clients() { List<DirectoryEntry> clients = new List<DirectoryEntry>(); try { foreach (DirectoryEntry child in domain.Children) { clients.Add(child); } } catch (System.Exception ex) { throw ex; } return clients; }DarrellNorto...
All-Star
87431 Points
9717 Posts
Moderator
MVP
Re: ComboBox driving me crazy
Feb 15, 2012 09:41 AM|LINK
Are you only populating the ListBox if !IsPostBack (If Not IsPostback in VB)? If you bind the ListBox again in Page_Load after a postback (which is what it sounds like you are doing), it will overwrite the selection before calling your ListBox_Selected event.
Darrell Norton's Blog
Please click "Mark as Answer" if this helped you.
Spyderco
Member
5 Points
9 Posts
Re: ComboBox driving me crazy
Feb 15, 2012 09:53 AM|LINK
Hi,
here is the method i am using for populating the list in page_load
if (!IsPostBack) { combClients.DataSource = ADLink.Clients(); combClients.DataBind(); }I dont have a selected event, could that be the problem?
Spyderco
Member
5 Points
9 Posts
Re: ComboBox driving me crazy
Feb 15, 2012 11:03 AM|LINK
Sorted it, was being a muppet, had a clear.items method being called on the combobox on page load :(