Show tif or pdf in DataList

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

I have a DataList control that shows jpg and gif images just fine. I am
filling the DataList from a list of files in a directory. The directory
might contain tif and pdf files but all that shows in the DataList is the
red X for these files. Am I asking it to do something that is not possible?
If not, are there any alternatives to showing a reduced image for other file
types in a DataList? Thanks.
My DataList control is shown below.

<asp:DataList ID="PicturesInFolder" runat="server"
CellPadding="3" Visible="true" BorderColor="Black"
ItemStyle-BorderWidth="1pt"
ItemStyle-BorderColor="Black" ItemStyle-BorderStyle="Solid" Width="540"
RepeatDirection="Horizontal"
RepeatLayout="Table" RepeatColumns="3"
OnItemDataBound="PicturesInFolder_ItemDataBound">
<ItemTemplate>
<asp:Image runat="server" ID="Picture"
ImageUrl='<%# Eval("FullName").ToString() %>' Width="180" Height="135" />
</ItemTemplate>
<AlternatingItemStyle BackColor="Transparent" />
</asp:DataList></td>


David
 
David C said:
I have a DataList control that shows jpg and gif images just fine. I am
filling the DataList from a list of files in a directory. The directory
might contain tif and pdf files but all that shows in the DataList is the
red X for these files. Am I asking it to do something that is not possible?
If not, are there any alternatives to showing a reduced image for other file
types in a DataList? Thanks.
My DataList control is shown below.

<asp:DataList ID="PicturesInFolder" runat="server"
CellPadding="3" Visible="true" BorderColor="Black"
ItemStyle-BorderWidth="1pt"
ItemStyle-BorderColor="Black" ItemStyle-BorderStyle="Solid" Width="540"
RepeatDirection="Horizontal"
RepeatLayout="Table" RepeatColumns="3"
OnItemDataBound="PicturesInFolder_ItemDataBound">
<ItemTemplate>
<asp:Image runat="server" ID="Picture"
ImageUrl='<%# Eval("FullName").ToString() %>' Width="180" Height="135" />
</ItemTemplate>
<AlternatingItemStyle BackColor="Transparent" />
</asp:DataList></td>

David

To shed some light on your issue, you should view the resulting webpage
source with the image tag and it's image path.

If the path is NOT to an ~/images/ folder w/in your webapp, you should try
placing a few sample images as such - storing images in other locations where
permissions, mappings are not universal could be your problem.

If this is still an issue, you may wish to post a followup with any new
considerations or responces to the points I've raised.
 
Jeff,
The DataList does generate img html tags as output and the src is a path to
the file.
The images are in a virtual directory on the website e.g. /photos so
permissions is not an issue.

p.s. Do you know how I could create a stream for these images and populate
the DataList? I have not worked with Streams before. Thanks.

David
 
Back
Top