Thanks Bill,
I have no problem when my datasource is a database or something similar it
is just when I use DirectoryServices
For some reason I cant get it to work...
Here is my databind!
Would really appritiate any help anyone can provide!
Thanks
...CODE
Sub GetUserADInfo()
Dim strUserName As String
Dim strADPath As String
strUserName = "netadmin" 'HttpContext.Current.User.Identity.Name
strADPath = "netdomain.usembassy.dk"
Dim Entry As DirectoryEntry = New DirectoryEntry("LDAP://" &
strADPath, "netadmin", "N3753rv3r0!")
' Create a DirectorySearcher object.
Dim mySearcher As New DirectorySearcher(Entry)
' Use the FindOne method to find the object, which in this case, is
the user
' indicated by User Name and assign it to a SearchResult.
mySearcher.Filter = ("(&(objectCategory=person)(objectClass=user))" )
'Dim MySearchResult As SearchResult = mySearcher.FindOne
Dim results As SearchResultCollection
results = mySearcher.FindAll()
dgADUserInfo.DataSource = results
dgADUserInfo.DataBind()
End Sub
"Bill Borg" wrote:
Tim, the "canned" columns like hyperlinkcolumn and boundcolumn don't get
databound themselves. Instead, you specify just the field names from the
datasource on the datagrid. So, for DataNavigateUrlField just enter the field
name that corresponds to the {0} in your format string.
e.g. from the docs...
<Columns>
<asp:HyperLinkColumn
HeaderText="Select an Item"
DataNavigateUrlField="IntegerValue"
DataNavigateUrlFormatString="detailspage.aspx?id={ 0}"
DataTextField="PriceValue"
DataTextFormatString="{0:c}"
Target="_blank"/>
</Columns>
Or, skip the hyperlinkcolumn, create your own itemtemplate, and add your own
asp:hyperlink that you can databind to (I find this way easier and more
flexible than the canned choices).
Bill
"Tim::.." wrote:
I keep getting the following error when trying to do the following!
'DataBinding' is not an event of 'System.Web.UI.WebControls.HyperLinkColumn'.
How do I get the value Name into the DataNavigateURLField??? I would really
appritiate any advice! Thanks
<asp:hyperlinkcolumn
DataNavigateUrlField='<%#Replace(Container.DataIte m.GetDirectoryEntry().Name,"CN=","")%>'
DataNavigateUrlFormatString="usrManDetails.aspx?id ={0}" Text="<img border=0
src=../images/edit.gif alt=Edit Page>">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:hyperlinkcolumn>