Hi.
I have a script that shows some files from a folder.
code_behind
main_codeCode:Sub fileinfo() Dim objDI As New System.IO.DirectoryInfo(Server.MapPath("upload/files/")) Dim allFile As New ArrayList() allFile.AddRange(objDI.GetFiles("*.png")) allFile.AddRange(objDI.GetFiles("*.jpg")) allFile.AddRange(objDI.GetFiles("*.bmp")) allFile.AddRange(objDI.GetFiles("*.gif")) allFile.AddRange(objDI.GetFiles("*.pdf")) allFile.AddRange(objDI.GetFiles("*.doc")) allFile.AddRange(objDI.GetFiles("*.docx")) Me.showfiles.DataSource = allFile Me.showfiles.DataBind() End Sub
works fine with images, but if i add a document like a pdf file i get this.Code:<ul class="thumbnails"> <asp:DataList ID="showfiles" runat="server" RepeatColumns="6" CellPadding="10" RepeatLayout="flow"> <ItemTemplate> <li class="span2"><a class="thumbnail" href="#"><asp:ImageButton ID="folderfiles" runat="server" ImageUrl='<%# string.Format("upload/files/{0}", DataBinder.Eval(Container.DataItem,"Name")) %>' ToolTip='<%# Bind("Name") %>' height="82" width="119" /></a></li> </ItemTemplate> </asp:DataList> </ul>
then it add the textbox, how can i add an if statsment or something that can add:
pdficon.jpg for .pdf files
docicon.jpg for .doc files
zipicon.jpg for .zip files
so if the file is an image then it works like now, and when the file is an pdf or doc file, then it use the icon image and display that !?




Reply With Quote
