c# - In ASP.NET, how can I get an image from the code behind and display it in a <div> section? -


boss gave me webpage work with, , i've never done webpages before. when got there image need replace

<div>     <!--<img style="padding-top:5px;" class="featured" src="path/name.jpg" />-->     html text 

i had go in .cs file of .aspx file , path image

image image = new image(); image.imageurl = path; 

and old image was

<div>     <asp:image style="padding-top:5px;" class="featured" runat="server" id="image" />     html text 

but i'm not sure how new image display correctly old 1 was, since i've never worked asp files before. suggestions on do?

in asp code, give image element id:

<asp:image id="setincode" width="250" runat="server" /> 

in code-behind, retrieve control id, can set url:

image img = (image)findcontrol("setincode"); img.imageurl = "images/butterfly.jpg"; 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -