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 i开发者_运维问答mage tag with asp.net/C#?
e.g.
<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?
精彩评论