Hello community! My first post here. (might probably have been under c#.. filename.asp.cs)

I have a web AD management project undergoing as I am currently at testing.. the interface *yay*

Extent of the project; pulling a list of employees managed by Mr X. Edit specific fields.

I'm building my interface through the on_load() where I call two methods

protected void Page_Load(object sender, EventArgs e)
//Object that connects to my AD.
            ActiveDirectoryWrapper adWrapper = new ActiveDirectoryWrapper();
         //Get the manager name - didn't hook it up from the session here since I'm testing this form only.   
            foreach (SearchResult result in adWrapper.GetEmployeesOf(adWrapper.trunkateADSpath(adWrapper.userData.adsPath)))
                ResultPropertyCollection myResultPropColl;
                myResultPropColl = result.Properties;
                if (myResultPropColl.Contains("sAMAccountName"))
                    ActiveDirectoryWrapper employee = new ActiveDirectoryWrapper();
                    //Adding only the account name to a public list, it is used in conjucture with the TextBox fields.
//This method builds the interface for each employee with txtbox editable or not and checkbox editable or not. Each Control has an ID ("controlName"+"i"), runat="server"
                    addEmployeeToTableUI( employee, i.ToString());
                } //end if

It works fine, events are added to each control using the

txtboxName.TextChanged+= new EventHandler(this."event_method_name");

Sum it up, I have bunch of textbox and checkbox and radiobutton with each an EventHandler and AutoPostBack.

Problem: when there's a change, I think the AD members are not getting picked up in the same order, since the user name order differs (I'm trying to sort it alphabetically right now). So, I have an order user1, user2, user3 all being generated with their AD attributes. textchange pops up, modification is done in AD, page reloads leaving the txtbox field in the same order while picking a different order for the members.

I might have already resolve the problem with the alphabetic order I'm undergoing with, but if you have another solution (another method than on_load) that you know refreshes from the ground up on POST, it'd be great to know.

Edited by wickedBlast: Mentioning should've probably put it under c# forum.

6 Years
Discussion Span
Last Post by wickedBlast

Turns out the sort option from DirectoryEntries is very capricious;

DirectorySearcher search = new DirectorySearcher();
            search.Filter = String.Format("(manager={0})", managerName);
            search.Sort = new SortOption("sn", SortDirection.Descending);

I managed to sort the search using "sn" property, but using "sAMAccoutname", it wouldn't work. There must be some sort of case sensitivity, but I don't feel like trying every possibility.

Company will just have to suck it up resort to Surname sort!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.