Reputation: 11
i want to add image through img tag in C#.net i tried the following logic but it's not work
String img+="img src="abc.jpg"
if you know plz reply me
Upvotes: 0
Views: 20753
Reputation: 11397
Try this in .aspx page:
<asp:Image ID="Image1" runat="server" ImageUrl=""/>
Upvotes: 1
Reputation: 17804
In .aspx
<img id="image" runat="server" />
In code behind
image.Src = "abc.jpg";
Upvotes: 3
Reputation: 18192
Thats how normlly we do for html!!!
<img src="flower01.jpg" alt="Yellow Flower" width="150" height="100">
for asp we do
<asp:Image ID="imgMain" runat="server" ImageUrl="http://www.xyz.com/files/images/15%20Random%20Greenery.JPG"/>
can be done like this
Upvotes: 0
Reputation: 7201
In markup:
<asp:image id="myImage" runat="server" />
In code-behind:
myImage.ImageUrl = "abc.jpg";
Upvotes: 3