in asp.net, I'm trying to generate an image tag with:
var img = new HtmlGenericControl("img");
it seems to generate <img></img>
How would I generate a normal image tag with asp.net/C#?
eg
<img/>
There's a specialized html control for the image element.
System.Web.UI.HtmlControls.HtmlImage
which generates the html you want.
You are creating it as a generic html control. Try using the Image control:
var img = new Image();
Override the rendering method and use HtmlTextWriter.SelfClosingTagEnd to create a self closing tag?
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.