473,654 Members | 3,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADSI Datagrid Sorting???

Hi,

Can someone tell me how I sort a datagrid when using ActiveDirectory as my
Datasource! I would like to be able to add sorting to my datagrid but don't
know how to achive it!

Thanks for any advice!

Dim src As DirectorySearch er = New
DirectorySearch er("(&(objectCa tegory=Person)( objectClass=use r))")
createTable()
src.SearchRoot = de
src.SearchScope = SearchScope.Sub tree
For Each res As SearchResult In src.FindAll
Dim topRow As DataRow = ds.Tables("cont acts").NewRow
topRow("&nbsp;" ) = "<img src='../images/user.gif'>"

If res.Properties. Contains("sn") And
res.Properties. Contains("given Name") And res.Properties. Contains("Initi als")
Then
topRow("Name") = CStr(res.Proper ties("givenName ")(0)) & ", "
& CStr(res.Proper ties("sn")(0)) & " " & CStr(res.Proper ties("Initials" )(0))
Else
topRow("Name") = ""
End If

If res.Properties. Contains("physi calDeliveryOffi ceName") Then
topRow("Dept.") =
CStr(res.Proper ties("physicalD eliveryOfficeNa me")(0))
Else
topRow("Dept.") = ""
End If

If res.Properties. Contains("telep honeNumber") Then
topRow("Ext") = CStr(res.Proper ties("telephone Number")(0))
Else
topRow("Ext") = ""
End If

If res.Properties. Contains("mail" ) Then
topRow("Email") = CStr(res.Proper ties("mail")(0) )
Else
topRow("Email") = ""
End If
ds.Tables("cont acts").Rows.Add (topRow)


Next
DataGrid1.DataS ource = ds.Tables("cont acts")
DataGrid1.DataB ind()

End Sub

Private Sub createTable()
Dim tbcontacts As DataTable = New DataTable("cont acts")
tbcontacts.Colu mns.Add("&nbsp; ", System.Type.Get Type("System.St ring"))
tbcontacts.Colu mns.Add("Name", System.Type.Get Type("System.St ring"))
tbcontacts.Colu mns.Add("Dept." , System.Type.Get Type("System.St ring"))
tbcontacts.Colu mns.Add("Ext", System.Type.Get Type("System.St ring"))
tbcontacts.Colu mns.Add("Email" , System.Type.Get Type("System.St ring"))
ds.Tables.Add(t bcontacts)
End Sub
Nov 19 '05 #1
0 881

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
945
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child datagrid. HTML Datagrid1 TemplateColumn Table Header information Detail Information
4
2107
by: Manny Chohan | last post by:
hi guys, my code is returning an array and i need to create datagrid so that i can have sorting and implement prev....next function on it to navigate. is there any way this can be done in codebehind file. I am using c#. Thanks Manny
2
5126
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child datagrid. HTML Datagrid1 TemplateColumn Table Header information Detail Information
1
7117
by: ECD | last post by:
Hello all, I can usually find solutions to my .NET problems by searching these groups, but I'm stumped on this one. I have a datagrid in VB.NET (2.0 framework). I want to disable sorting on the first column in the grid only. I havent found a way to reliably do this yet. I tried putting the following code in the datagrid's mouse down event Dim hti As DataGrid.HitTestInfo
0
8290
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8489
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2716
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.