Image, DataGrid, DataBase, ActiveDirectory????

G

Guest

Little brain teaser for anyone...

I'm creating a contacts datagrid that is populated by a Active Directory but
I want to have a popup image of each contact when you mouseover there name...

I have got that far!

What I can't work out how to do is to match up the Active Directory record
with the correct image that is stored in an SQL database! I have been trying
to use a function but not really getting any where... (see below)

Would really appritiate any help thanks...


=======code=============

Function GetImages(ByVal imgID As Integer) As DataTable

Dim Myconn As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim cmd As New SqlCommand("GetEmployeeImgs", Myconn)
cmd.CommandType = CommandType.StoredProcedure

cmd.Parameters.Add(New SqlParameter("@imgID", imgID))

Dim myAdapter As New SqlDataAdapter(cmd)
Dim dt As New DataTable
Myconn.Open()
myAdapter.Fill(dt)
Myconn.Close()

Return dt
End Function

==========DataGrid==============

<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"
ShowFooter="True" OnPageIndexChanged="DataGrid1_Paged" Width="70%"
CellPadding="4" BorderWidth="1px" BorderStyle="Ridge" BorderColor="LightGray"
CssClass="txtArea" GridLines="Horizontal"
HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="True"
AlternatingItemStyle-BackColor="WhiteSmoke" AllowPaging="True"
PagerStyle-Mode="NextPrev" AllowSorting="True">
<AlternatingItemStyle BackColor="WhiteSmoke"></AlternatingItemStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<HeaderStyle Font-Bold="True" HorizontalAlign="Center"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<img ID="I<%# DataBinder.Eval(Container, "ItemIndex")%>"
src="../images/user.gif" style="cursor: hand"
onmouseover="javascript:showTopic(<%# DataBinder.Eval(Container,
"ItemIndex")%>);" onmouseout="javascript:hideImage(<%#
DataBinder.Eval(Container, "ItemIndex")%>);">
<DIV id='D<%# DataBinder.Eval(Container, "ItemIndex")%>' style="Z-INDEX: 1;
LEFT: 300px; POSITION: absolute; TOP: 100px; HEIGHT: 130px; WIDTH: 100px;
BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT:
black 1px solid; BORDER-BOTTOM: black 1px solid; BACKGROUND-COLOR: white;
display: none;"><asp:Image Runat="server" ID="userImage" ImageUrl="<%#
GetImages(DataBinder.Eval(Container.DataItem, "email")) %>"></asp:Image></DIV>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn HeaderText="Name" DataFormatString="{0}"
DataField="Name"></asp:BoundColumn>
</Columns>
</asp:datagrid><br>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top