Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have files on server which i want to display on a web page as Image followed by filename.

the Image will be dependent on the file type,

what I am doing is

asp:

<asp:LinkButton ID="LinkButton1" runat="server" Visible='false">
<img runat="server" id="Image2"/>
</asp:LinkButton>


c#:

C#
if (fi.Extension == ".txt")
                   {
                       Image2.Src = @"~\Upload\x_icon.png";
                       LinkButton1.Text = fi.Name;
                       LinkButton1.Visible = true;
                   }
                   else if (fi.Extension == ".docx")
                   {
                       Image2.Src = @"~\Upload\Add.jpg";
                       LinkButton1.Text = fi.Name;
                       LinkButton1.Visible = true;
                   }


but here I only get text propertu set. I do not see a Image.
Please help
Posted
Comments
ZurdoDev 2-Jul-13 7:50am    
Then the url is likely wrong. Right click it in the browser and look at the properties and you should see the path.

1 solution

<asp:LinkButton ID="LinkButton1" runat="server">
<img runat="server" id="Image2"/>
</asp:LinkButton>


TRy this you had put visbility false. How can you see an image if Visible Propert is false.
 
Share this answer
 
v3
Comments
maverick12131 2-Jul-13 9:36am    
visibility is true

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