简体   繁体   中英

HtmlTextWriter doesn't render HTML tags

I'm creating a web user crontrol, as the following

            output.AddAttribute(HtmlTextWriterAttribute.Style, "margin: 0 12px");
            output.RenderBeginTag(HtmlTextWriterTag.Span);
            output.Write("test_test");
            output.WriteEndTag("span");

But it only renders "test_test", without the SPAN tag. I tried several ways, but in the end only shows the text... :(

Could you help me?

Thanks in advance.

您应该使用output.RenderEndTag()而不是output.WriteEndTag("span");

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM