Hi
I'm trying to create a little application that shows an image of a user when
you mouseover there details in a datagrid. The datagrid is populated from an
Active Directory Database and I presume the best way to create the popup is
by using a layer with javascript hide and show...
I intend to use a database to store the pictures in and the use the users
full name to build a relationship between the database with the images and
the Active Directory...
Can someone please tell me how I change the layer ID in the datagrid and
<div> so that it is not always the same image that is shown???
Or alternatively how do I create a user control with a placement holder in
the layer that refers to the correct image
Or suggest a better way to achieve this...
I would really appritiate any help....
<Inline Code>
<!--Popup Layer with users info-->
<DIV id="Layer1" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000
1px solid; Z-INDEX: 1; LEFT: 300px; VISIBILITY: hidden; BORDER-LEFT: #000000
1px solid; WIDTH: 120px; BORDER-BOTTOM: #000000 1px solid; POSITION:
absolute; TOP: 100px; HEIGHT: 130px; BACKGROUND-COLOR:
#ffffff"><asp:p laceholder id="phIMGpopup "
runat="server"> </asp:placeholder ></DIV>
<!--End Popup Layer with users info-->
<asp:datagrid id="DataGrid1" runat="server" AllowSorting="T rue"
PagerStyle-Mode="NextPrev" AllowPaging="Tr ue"
AlternatingItem Style-BackColor="Whit eSmoke" HeaderStyle-Font-Bold="True"
HeaderStyle-HorizontalAlign ="Center" GridLines="Hori zontal"
CssClass="txtAr ea" BorderColor="Li ghtGray" BorderStyle="Ri dge"
BorderWidth="1p x" CellPadding="4" Width="70%"
OnPageIndexChan ged="DataGrid1_ Paged" ShowFooter="Tru e"
AutoGenerateCol umns="False">
<Columns>
<asp:HyperLinkC olumn HeaderText="" Text="<a href='#'
onMouseOver=MM_ showHideLayers( 'Layer1','','sh ow')
onMouseOut=MM_s howHideLayers(' Layer1','','hid e')><img
src='../images/user.gif' border='0'></a>"></asp:HyperLinkCo lumn>
</Columns>
</asp:datagrid>
<CodeBehind>
Sub BindGrid(Option al ByVal alpha As String = "")
Dim strADPath As String
strADPath = "netdomain.usem bassy.dk"
Dim de As DirectoryEntry = New DirectoryEntry( "LDAP://" & strADPath,
"netadmin", "N37au7h0R" )
Dim src As DirectorySearch er
If alpha = "" Then
DataGrid1.Allow Paging = True
src = New
DirectorySearch er("(&(objectCa tegory=Person)( objectClass=use r))")
Else
DataGrid1.Allow Paging = False
src = New
DirectorySearch er("(&(objectCa tegory=Person)( objectClass=use r)(sn=" & alpha &
"*))")
End If
src.SearchRoot = de
src.SearchScope = SearchScope.Sub tree
For Each res As SearchResult In src.FindAll
Dim dr As DataRow = ds.Tables("cont acts").NewRow
dr(" ") = "<img src='../images/user.gif'>"
If res.Properties. Contains("sn") And
res.Properties. Contains("given Name") And res.Properties. Contains("Initi als")
Then
dr("Name") = CStr(res.Proper ties("givenName ")(0)) & ", " &
CStr(res.Proper ties("sn")(0)) & " " & CStr(res.Proper ties("Initials" )(0))
Else
dr("Name") = ""
End If
If res.Properties. Contains("physi calDeliveryOffi ceName") Then
dr("Dept.") =
CStr(res.Proper ties("physicalD eliveryOfficeNa me")(0))
Else
dr("Dept.") = ""
End If
If res.Properties. Contains("telep honeNumber") Then
Dim TeleNumber As String =
CStr(res.Proper ties("telephone Number")(0))
dr("Ext") = "#" & Right(TeleNumbe r, Len(TeleNumber) -
InStr(TeleNumbe r, "1"))
Else
dr("Ext") = ""
End If
If res.Properties. Contains("mail" ) Then
dr("Email") = CStr(res.Proper ties("mail")(0) )
Else
dr("Email") = ""
End If
ds.Tables("cont acts").Rows.Add (dr)
Next
' Binds Contact data from Active Directory to DataGrid
DataGrid1.DataS ource = ds.Tables("cont acts")
DataGrid1.DataB ind()
End Sub
I'm trying to create a little application that shows an image of a user when
you mouseover there details in a datagrid. The datagrid is populated from an
Active Directory Database and I presume the best way to create the popup is
by using a layer with javascript hide and show...
I intend to use a database to store the pictures in and the use the users
full name to build a relationship between the database with the images and
the Active Directory...
Can someone please tell me how I change the layer ID in the datagrid and
<div> so that it is not always the same image that is shown???
Or alternatively how do I create a user control with a placement holder in
the layer that refers to the correct image
Or suggest a better way to achieve this...
I would really appritiate any help....
<Inline Code>
<!--Popup Layer with users info-->
<DIV id="Layer1" style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000
1px solid; Z-INDEX: 1; LEFT: 300px; VISIBILITY: hidden; BORDER-LEFT: #000000
1px solid; WIDTH: 120px; BORDER-BOTTOM: #000000 1px solid; POSITION:
absolute; TOP: 100px; HEIGHT: 130px; BACKGROUND-COLOR:
#ffffff"><asp:p laceholder id="phIMGpopup "
runat="server"> </asp:placeholder ></DIV>
<!--End Popup Layer with users info-->
<asp:datagrid id="DataGrid1" runat="server" AllowSorting="T rue"
PagerStyle-Mode="NextPrev" AllowPaging="Tr ue"
AlternatingItem Style-BackColor="Whit eSmoke" HeaderStyle-Font-Bold="True"
HeaderStyle-HorizontalAlign ="Center" GridLines="Hori zontal"
CssClass="txtAr ea" BorderColor="Li ghtGray" BorderStyle="Ri dge"
BorderWidth="1p x" CellPadding="4" Width="70%"
OnPageIndexChan ged="DataGrid1_ Paged" ShowFooter="Tru e"
AutoGenerateCol umns="False">
<Columns>
<asp:HyperLinkC olumn HeaderText="" Text="<a href='#'
onMouseOver=MM_ showHideLayers( 'Layer1','','sh ow')
onMouseOut=MM_s howHideLayers(' Layer1','','hid e')><img
src='../images/user.gif' border='0'></a>"></asp:HyperLinkCo lumn>
</Columns>
</asp:datagrid>
<CodeBehind>
Sub BindGrid(Option al ByVal alpha As String = "")
Dim strADPath As String
strADPath = "netdomain.usem bassy.dk"
Dim de As DirectoryEntry = New DirectoryEntry( "LDAP://" & strADPath,
"netadmin", "N37au7h0R" )
Dim src As DirectorySearch er
If alpha = "" Then
DataGrid1.Allow Paging = True
src = New
DirectorySearch er("(&(objectCa tegory=Person)( objectClass=use r))")
Else
DataGrid1.Allow Paging = False
src = New
DirectorySearch er("(&(objectCa tegory=Person)( objectClass=use r)(sn=" & alpha &
"*))")
End If
src.SearchRoot = de
src.SearchScope = SearchScope.Sub tree
For Each res As SearchResult In src.FindAll
Dim dr As DataRow = ds.Tables("cont acts").NewRow
dr(" ") = "<img src='../images/user.gif'>"
If res.Properties. Contains("sn") And
res.Properties. Contains("given Name") And res.Properties. Contains("Initi als")
Then
dr("Name") = CStr(res.Proper ties("givenName ")(0)) & ", " &
CStr(res.Proper ties("sn")(0)) & " " & CStr(res.Proper ties("Initials" )(0))
Else
dr("Name") = ""
End If
If res.Properties. Contains("physi calDeliveryOffi ceName") Then
dr("Dept.") =
CStr(res.Proper ties("physicalD eliveryOfficeNa me")(0))
Else
dr("Dept.") = ""
End If
If res.Properties. Contains("telep honeNumber") Then
Dim TeleNumber As String =
CStr(res.Proper ties("telephone Number")(0))
dr("Ext") = "#" & Right(TeleNumbe r, Len(TeleNumber) -
InStr(TeleNumbe r, "1"))
Else
dr("Ext") = ""
End If
If res.Properties. Contains("mail" ) Then
dr("Email") = CStr(res.Proper ties("mail")(0) )
Else
dr("Email") = ""
End If
ds.Tables("cont acts").Rows.Add (dr)
Next
' Binds Contact data from Active Directory to DataGrid
DataGrid1.DataS ource = ds.Tables("cont acts")
DataGrid1.DataB ind()
End Sub
Comment