Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any way to pull multiple file formats from a source?
I am currently pulling all .jpg files but I like to be able to pull both .jpg and .pdf.

Thanks

What I have tried:

<itemtemplate>
<asp:HyperLink ID="HyperLinkParts" runat="server" Text= '<%# Eval("PartNumber") %>'
NavigateUrl= '<%#Eval("PartNumber", "~/Hardware/{0}.jpg") %>'
Posted
Comments
Maciej Los 12-Feb-18 16:39pm    
I'd strongly suggest to read this: ASP.NET data binding overview[^]
Laxmidhar tatwa technologies 13-Feb-18 1:46am    
Dynamically define cell type
F-ES Sitecore 13-Feb-18 4:34am    
You'll probably need to do your data-binding in the code-behind rather than use Eval in the mark-up. It gives you much better control and you can bind to different extensions depending on the data-type as you're obviously hard-coding to jpg in the mark-up.
m-masood 13-Feb-18 14:12pm    
Can you please give me and example? Thank you!!
F-ES Sitecore 14-Feb-18 4:52am    
This shows the basic principals

https://www.aspsnippets.com/Articles/Find-Access-control-inside-GridView-in-RowDataBound-and-RowCommand-events-of-ASPNet-GridView.aspx

So you use FindControl to get the hyperlink in your row binding event and you update the NavigateUrl of that link depending on the data for that row....so if you're binding to an image use the right extension, if it's a pdf use the extension for that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900