G
Guest
Can someone please tell me how I put the following information into a
datagrid...
I want to be able to use templatecolumns in a datagrid to reformat the
information I have pulled from an ActiveDirectory Database! I'm just not
quite sure how to pull the info into the datagrid!
I tried...
<asp:TemplateColumn HeaderText="">
<ItemTemplate>
<asp:HyperLink Runat =server NavigateUrl
='<%#DataBinder.Eval(Container.DataItem, "givenName")%>' ID="Hyperlink1"
NAME="Hyperlink1">
<img src="../images/user.gif" border="0">
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
I would be really grateful for any tips anyone might have!
Thanks
.....CODE....
src.SearchRoot = de
src.SearchScope = SearchScope.Subtree
For Each res As SearchResult In src.FindAll
Dim dr As DataRow = ds.Tables("contacts").NewRow
dr(" ") = "<img src='../images/user.gif'>"
If res.Properties.Contains("sn") And
res.Properties.Contains("givenName") And res.Properties.Contains("Initials")
Then
dr("Name") = CStr(res.Properties("givenName")(0)) & ", " &
CStr(res.Properties("sn")(0)) & " " & CStr(res.Properties("Initials")(0))
Else
dr("Name") = ""
End If
If res.Properties.Contains("physicalDeliveryOfficeName") Then
dr("Dept.") =
CStr(res.Properties("physicalDeliveryOfficeName")(0))
Else
dr("Dept.") = ""
End If
If res.Properties.Contains("telephoneNumber") Then
Dim TeleNumber As String =
CStr(res.Properties("telephoneNumber")(0))
dr("Ext") = "#" & Right(TeleNumber, Len(TeleNumber) -
InStr(TeleNumber, "1"))
Else
dr("Ext") = ""
End If
If res.Properties.Contains("mail") Then
dr("Email") = CStr(res.Properties("mail")(0))
Else
dr("Email") = ""
End If
ds.Tables("contacts").Rows.Add(dr)
datagrid...
I want to be able to use templatecolumns in a datagrid to reformat the
information I have pulled from an ActiveDirectory Database! I'm just not
quite sure how to pull the info into the datagrid!
I tried...
<asp:TemplateColumn HeaderText="">
<ItemTemplate>
<asp:HyperLink Runat =server NavigateUrl
='<%#DataBinder.Eval(Container.DataItem, "givenName")%>' ID="Hyperlink1"
NAME="Hyperlink1">
<img src="../images/user.gif" border="0">
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
I would be really grateful for any tips anyone might have!
Thanks
.....CODE....
src.SearchRoot = de
src.SearchScope = SearchScope.Subtree
For Each res As SearchResult In src.FindAll
Dim dr As DataRow = ds.Tables("contacts").NewRow
dr(" ") = "<img src='../images/user.gif'>"
If res.Properties.Contains("sn") And
res.Properties.Contains("givenName") And res.Properties.Contains("Initials")
Then
dr("Name") = CStr(res.Properties("givenName")(0)) & ", " &
CStr(res.Properties("sn")(0)) & " " & CStr(res.Properties("Initials")(0))
Else
dr("Name") = ""
End If
If res.Properties.Contains("physicalDeliveryOfficeName") Then
dr("Dept.") =
CStr(res.Properties("physicalDeliveryOfficeName")(0))
Else
dr("Dept.") = ""
End If
If res.Properties.Contains("telephoneNumber") Then
Dim TeleNumber As String =
CStr(res.Properties("telephoneNumber")(0))
dr("Ext") = "#" & Right(TeleNumber, Len(TeleNumber) -
InStr(TeleNumber, "1"))
Else
dr("Ext") = ""
End If
If res.Properties.Contains("mail") Then
dr("Email") = CStr(res.Properties("mail")(0))
Else
dr("Email") = ""
End If
ds.Tables("contacts").Rows.Add(dr)