Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Binding src in img tag

Status
Not open for further replies.

mych

Programmer
May 20, 2004
248
GB
Hi,

I've created a listview (actually 7 of them) and they look like this....
Code:
<div class="block_DaySm">
                            <asp:ListView ID="lv_BookingDay1" runat="server" DataSourceID="SqlDSBookingsSunday" DataKeyNames="B_ID">
                                <LayoutTemplate>
                                    <div id="dv_BookingsD1" runat="server">
                                        <div runat="server" id="itemPlaceholder" />
                                    </div>
                                </LayoutTemplate>
                                <ItemTemplate>
                                    <div ID="dv_indiBooking" runat="server" class="indiBooking">
                                    [red]<div ID="dv_indiImage" runat="server" class="indiImage"><img alt="Vehicle Hired" src='<%# Bind("B_LogoRef") %>' /></div>[/red]
                                        <div ID="dv_indiDetail" runat="server" class="indiDetail">
                                            <div ID="dv_indiTOut" runat="server" class="indiTime"><img alt="Time Out" src="images/alarm16.png" />&nbsp;<asp:Label ID="lb_PickupTime" runat="server" Text='<%# Bind("B_HireDate") %>' ></asp:Label></div>
                                            <div ID="dv_indiPCity" runat="server" class="indiCity"><asp:Label ID="lb_PickupCity" runat="server" Text='<%# Bind("B_PickupCity") %>'></asp:Label></div>
                                            <div ID="dv_indiClear1" runat="server" class="clear"></div>
                                            <div ID="dv_indiTFin" runat="server" class="indiTime"><img alt="Time Finished" src="images/alarm16.png" />&nbsp;<asp:Label ID="lb_FinishTime" runat="server" Text='<%# Bind("B_FinishTime") %>' ></asp:Label></div>
                                            <div ID="dv_indiDCity" runat="server" class="indiCity"><asp:Label ID="lb_DestinationCity" runat="server" Text='<%# Bind("B_DestinationCity") %>'></asp:Label></div>
                                            <div ID="dv_indiClear2" runat="server" class="clear"></div>
                                            <div ID="dv_indiPassg" runat="server" class="indiTime"><img alt="Passengers" src="images/user_16.png" />&nbsp;<asp:Label ID="lb_Passengers" runat="server" Text='<%# Bind("B_Passengers") %>' ></asp:Label></div>
                                            <div ID="dv_indiPrice" runat="server" class="indiPrice">£480.00</div>
                                            <div ID="dv_indiDir" runat="server" class="indiDirection"><img alt='<%# Bind("B_BookingType") %>' src="images/" & <%# Bind("B_Passengers") %> & "16.png" /></div>
                                         </div> 
                                    </div>
                                </ItemTemplate>
                            </asp:ListView>
                            <asp:SqlDataSource ID="SqlDSBookingsSunday" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:SVLimoConnectionString %>" 
                                SelectCommand="SELECT [B_ID], [B_HireVehicle], [B_Passengers], [B_PickupCity], [B_DestinationCity], [B_FinishTime], [B_ExtraFlag], [B_InstrFlag], [B_ReasonForHire], [B_LogoRef] FROM [tbl_Bookings] WHERE (([B_HireDate] &gt;= @B_HireDate) AND ([B_HireDate] &lt; @B_HireDate2)) ORDER BY [B_HireVehicle], [B_HireDate]">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="lb_BookingsDay1" Name="B_HireDate" 
                                        PropertyName="Text" Type="DateTime" />
                                    <asp:ControlParameter ControlID="lb_BookingsDay2" Name="B_HireDate2" 
                                        PropertyName="Text" Type="DateTime" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </div>

The issue I'm having is the line in red where I'm getting an error
ASP.NET runtime error: A call to Bind must be assigned to a property of a control inside a template

This has me foxed as I'm inside the ItemTemplate...

Any help would be appreciated.


I've not failed! Just found 100 ways that don't work...yet!
 
I could kick myself sometimes... Thanks

I've not failed! Just found 100 ways that don't work...yet!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top