I am trying to add an asp.net image control () in a panel at runtime.
I have the asp.net code in the label text as <asp:Image runat="server" ImageUrl="test.png"/>
(its just a example)
When I added this label in the panel control with: pnlPlaceHolderPanel.Controls.Add(htmlLabel);
The image does not display. When I checked the HTML using inspect element in the browser , the element displayed in <asp:Image>
, but it should be <img>
tag of HTML.
So does anybody know how should I convert that asp.net design code into HTML code?
You need to reference ASP.Net Controls with the : sign:
<asp:Image runat="server" ImageUrl="test.png" />
where the asp: is the namespace reference where the control is located. As a reference
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.