PDA

View Full Version : Datalist SelectedItemTemplate


annbransom
06-01-2007, 04:16 AM
Okay, I am having all kinds of problems with the Datalist SelectedItemTemplate. I've got two datalists pulling from two seperate SQL Datasources. I have a button that I want a user to be able to click to get details about an company employee.

Right now, the pictures are not showing up in Firefox, but they do in IE. To get the details to display you have to click the select button twice (not double click, click twice). Finally the selectedItemTemplate is only displaying the first name, last name, and title. Obviously, I am not doing this right. To see the actual page go to www.kyagencygroup.com/employeeinfo.aspx (http://www.kyagencygroup.com/employeeinfo.aspx).

Here is my code:




<%@ Page Language="VB" MasterPageFile="~/MasterPage2.master" AutoEventWireup="false" CodeFile="employeeinfo.aspx.vb" Inherits="employeeinfo" title="Kentucky Agency Group - Staff" debug=true MaintainScrollPositionOnPostback=true%>


<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">


<span style="font-family: Arial"><span style="font-size: 36pt">


<table align="center" width="750" style="font-size: 36pt">


<tr>


<td style="text-align: center; height: 69px;">





M<span style="font-size: 14pt"><strong>eet </strong><span style="font-size: 36pt">O</span><strong>ur </strong><span style="font-size: 36pt">S</span><strong>taff</strong></span></td>


</tr>


<tr>


<td style="text-align: center; font-size: 12pt;">


&amp;nbsp;<asp:DataList ID="DataList1" runat="server" BorderColor="Black" BorderStyle="Solid"


BorderWidth="1px" DataKeyField="StaffID" DataSourceID="SqlDataSource1" GridLines="Both"


RepeatColumns="3" RepeatDirection="Horizontal" Width="675px" HorizontalAlign="Center">


<ItemTemplate>


<asp:Image ID="Image1" runat="server" Height="150px" ImageUrl='<%# Eval("PicURL") %>'


Width="150px" />&amp;nbsp;[b]


<asp:Label ID="FirstNameLabel" runat="server" Font-Bold="True" Font-Names="Verdana"


Font-Size="9pt" Text='<%# Eval("FirstName") %>'></asp:Label>


<asp:Label ID="LastNameLabel" runat="server" Font-Bold="True" Font-Names="Verdana"


Font-Size="9pt" Text='<%# Eval("LastName") %>'></asp:Label>[b]


<asp:Label ID="TitleLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Eval("Title") %>'></asp:Label>[b]


[b]


<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Select"


Font-Names="Verdana" Font-Size="9pt">View Details</asp:LinkButton>


</ItemTemplate>


<ItemStyle HorizontalAlign="Center" Width="33%" />


<HeaderTemplate>


Bush &amp;amp; Boggs Insurance Agency Staff


</HeaderTemplate>


<HeaderStyle Font-Bold="True" Height="40px" />


<SelectedItemTemplate>


<asp:Label ID="StaffIDLabel" runat="server" Font-Size="9pt" Text='<%# Eval("StaffID") %>'


Visible="False"></asp:Label>[b]


<asp:Label ID="FirstNameLabel" runat="server" Font-Names="Verdana" Font-Size="9pt"


Text='<%# Bind("FirstName") %>'></asp:Label><span style="font-size: 9pt; font-family: Verdana">


</span>


<asp:Label ID="LastNameLabel" runat="server" Font-Names="Verdana" Font-Size="9pt"


Text='<%# Bind("LastName") %>'></asp:Label><span style="font-size: 9pt; font-family: Verdana">


[b]


</span>


<asp:Label ID="TitleLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("Title") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">Location: </span>


<asp:Label ID="LocationLabel" runat="server" Font-Names="Verdana" Font-Size="9pt"


Text='<%# Bind("Location") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">Address: </span>


<asp:Label ID="AddressLabel" runat="server" Font-Names="Verdana" Font-Size="9pt"


Text='<%# Bind("Address") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">City: </span>


<asp:Label ID="CityLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("City") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">State: </span>


<asp:Label ID="StateLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("State") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">Zip Code: </span>


<asp:Label ID="ZipCodeLabel" runat="server" Font-Names="Verdana" Font-Size="9pt"


Text='<%# Bind("ZipCode") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">E-mail: </span>


<asp:HyperLink ID="email" runat="server" Font-Names="Verdana" Font-Size="9pt" NavigateUrl='<%# Eval("email", "mailto:{0}") %>'


Text='<%# Eval("Email") %>'></asp:HyperLink>[b]


<span style="font-size: 9pt; font-family: Verdana">Phone: </span>


<asp:Label ID="PhoneLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("Phone") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">Fax: </span>


<asp:Label ID="FaxLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("Fax") %>'></asp:Label><span


style="font-size: 9pt; font-family: Verdana">&amp;nbsp;[b]


Notes: </span>


<asp:Label ID="NotesLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("Notes") %>'></asp:Label>[b]


</SelectedItemTemplate>


</asp:DataList>[b]


<asp:DataList ID="DataList2" runat="server" BorderColor="Black" BorderStyle="Solid"


BorderWidth="1px" DataKeyField="StaffID" DataSourceID="SqlDataSource2" GridLines="Both"


RepeatColumns="3" RepeatDirection="Horizontal" Width="675px" HorizontalAlign="Center">


<ItemTemplate>


<asp:Image ID="Image1" runat="server" Height="150px" ImageUrl='<%# Eval("PicURL") %>'


Width="150px" />&amp;nbsp;[b]


<asp:Label ID="FirstNameLabel" runat="server" Font-Bold="True" Font-Names="Verdana"


Font-Size="9pt" Text='<%# Eval("FirstName") %>'></asp:Label>


<asp:Label ID="LastNameLabel" runat="server" Font-Bold="True" Font-Names="Verdana"


Font-Size="9pt" Text='<%# Eval("LastName") %>'></asp:Label>[b]


<asp:Label ID="TitleLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Eval("Title") %>'></asp:Label>[b]


[b]


<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Select"


Font-Names="Verdana" Font-Size="9pt">View Details</asp:LinkButton>


</ItemTemplate>


<ItemStyle HorizontalAlign="Center" Width="33%" />


<HeaderTemplate>


Kentucky Insurance Agency Staff


</HeaderTemplate>


<HeaderStyle Font-Bold="True" Height="50px" />


<SelectedItemTemplate>


<asp:Label ID="StaffIDLabel" runat="server" Font-Size="9pt" Text='<%# Eval("StaffID") %>'


Visible="False"></asp:Label>[b]


<asp:Label ID="FirstNameLabel" runat="server" Font-Names="Verdana" Font-Size="9pt"


Text='<%# Bind("FirstName") %>'></asp:Label><span style="font-size: 9pt; font-family: Verdana">


</span>


<asp:Label ID="LastNameLabel" runat="server" Font-Names="Verdana" Font-Size="9pt"


Text='<%# Bind("LastName") %>'></asp:Label><span style="font-size: 9pt; font-family: Verdana">


[b]


</span>


<asp:Label ID="TitleLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("Title") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">Location: </span>


<asp:Label ID="LocationLabel" runat="server" Font-Names="Verdana" Font-Size="9pt"


Text='<%# Bind("Location") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">Address: </span>


<asp:Label ID="AddressLabel" runat="server" Font-Names="Verdana" Font-Size="9pt"


Text='<%# Bind("Address") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">City: </span>


<asp:Label ID="CityLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("City") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">State: </span>


<asp:Label ID="StateLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("State") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">Zip Code: </span>


<asp:Label ID="ZipCodeLabel" runat="server" Font-Names="Verdana" Font-Size="9pt"


Text='<%# Bind("ZipCode") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">E-mail: </span>


<asp:HyperLink ID="email" runat="server" Font-Names="Verdana" Font-Size="9pt" NavigateUrl='<%# Eval("email", "mailto:{0}") %>'


Text='<%# Eval("Email") %>'></asp:HyperLink>[b]


<span style="font-size: 9pt; font-family: Verdana">Phone: </span>


<asp:Label ID="PhoneLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("Phone") %>'></asp:Label>[b]


<span style="font-size: 9pt; font-family: Verdana">Fax: </span>


<asp:Label ID="FaxLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("Fax") %>'></asp:Label><span


style="font-size: 9pt; font-family: Verdana">&amp;nbsp;[b]


Notes: </span>


<asp:Label ID="NotesLabel" runat="server" Font-Names="Verdana" Font-Size="9pt" Text='<%# Bind("Notes") %>'></asp:Label>[b]


</SelectedItemTemplate>


</asp:DataList>





</td>


</tr>


</table>


</span><strong><span style="font-size: 12pt"></span></strong></span>


[b]


<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DB_289323_kyagencyConnectionStri ng %>"


SelectCommand="SELECT * FROM [Staff] WHERE ([Office] = @Office) ORDER BY [LastName], [FirstName]" DeleteCommand="DELETE FROM [Staff] WHERE [StaffID] = @StaffID" InsertCommand="INSERT INTO [Staff] ([FirstName], [LastName], [Location], [Address], [City], [State], [ZipCode], [Email], [Phone], [Fax], [PicURL], [Notes], [Title], [Office]) VALUES (@FirstName, @LastName, @Location, @Address, @City, @State, @ZipCode, @Email, @Phone, @Fax, @PicURL, @Notes, @Title, @Office)" UpdateCommand="UPDATE [Staff] SET [FirstName] = @FirstName, [LastName] = @LastName, [Location] = @Location, [Address] = @Address, [City] = @City, [State] = @State, [ZipCode] = @ZipCode, [Email] = @Email, [Phone] = @Phone, [Fax] = @Fax, [PicURL] = @PicURL, [Notes] = @Notes, [Title] = @Title, [Office] = @Office WHERE [StaffID] = @StaffID">


<SelectParameters>


<asp:Parameter DefaultValue="Bush &amp;amp; Boggs" Name="Office" Type="String" />


</SelectParameters>


<DeleteParameters>


<asp:Parameter Name="StaffID" Type="Int32" />


</DeleteParameters>


<UpdateParameters>


<asp:Parameter Name<FONT color=#0000f

raymondp
06-12-2007, 10:29 AM
I pulled up your site and I could see the images both in Firefox and IE 7. Are you still experiencing the issue?

annbransom
06-14-2007, 12:26 PM
The images showing up in Firefox issue has been resolved, but all of my other issues still remain.