I am trying to hide an image in a formview if the imageurl is blank.
Site is driven by database - and if there is nothing in the database as a picture filename then I want to hide the image - If there is a filename in the database I want to show the image.
Showing is not a problem - but I dont want to show an empty placeholder box on the website if there is no file to display.
Tried various methods to no avail.
C# would be ideal as all my other code in C#
Thanks in advance
Code is below
Site is driven by database - and if there is nothing in the database as a picture filename then I want to hide the image - If there is a filename in the database I want to show the image.
Showing is not a problem - but I dont want to show an empty placeholder box on the website if there is no file to display.
Tried various methods to no avail.
C# would be ideal as all my other code in C#
Thanks in advance
Code is below
Code:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:qbConnectionString %>" SelectCommand="SELECT * FROM [tbl_PageInfo] WHERE ([type] = @type)"> <SelectParameters> <asp:QueryStringParameter Name="type" QueryStringField="pageid" /> </SelectParameters> </asp:SqlDataSource> <asp:FormView ID="FormView2" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate> <asp:Image runat="server" ID="titleimage" ImageUrl='<%#Eval("picturefilename","http://bytes.com/images/{0}") %>' alt='<%# Eval("para1title") %>' Width="200" Height="140" /> ... .. </ItemTemplate> </asp:FormView>
Comment