Datagrid template column using Excel or Adobe PDF images.

Joined
Dec 9, 2008
Messages
5
Reaction score
0
I am using a template column in a datagrid and I want to use different images depending on what type of file it is(PDF, Excel, Word, etc). There is a field called extenstion that has xls or pdf in it depending on which file is being used. The image url should show the image. I know the images are in the path I specify. Does anyone how to configure the template column to call the appropriate extension depending on what kind of file it is? Here is my code for the datagrid:

Code:
<asp:Datagrid ID="MonthlyDownloadsGrid" OnDeleteCommand="MonthlyDownloadsGridDelete" OnItemCreated="MonthlyDownloadsGrid_ItemDataBound" BorderWidth="2pt" BorderStyle="Double" BorderColor="Black" runat="server" AutoGenerateColumns="False"Width="728px"><Columns>
<asp:TemplateColumn HeaderStyle-BorderColor = "Black" HeaderStyle-BorderStyle ="Inset" ItemStyle-BorderColor = "Black" ItemStyle-BorderStyle="Inset" HeaderText="File Type"><ItemTemplate><asp:HyperLink ID="hlThumbnails" Target="_blank" ImageUrl='images/reports/Repdown_<%# Eval("extension") %>icon.gif' runat="server" NavigateUrl='<%# Eval("finalpath") %> '></asp:HyperLink>
</ItemTemplate></asp:TemplateColumn></Columns>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top