asp.net cannot get internal content, because the content is not a text solution _ Practical Tips

Source: Internet
Author: User
Today dynamically generates an HTML control in the background, similar to this htmltablecell cell = new HtmlTableCell ();
directly to the cell. InnerHtml = "Cell HTML code"; then the page display is OK when using the cell. Controls.Add (new Control ()) the page is output as: "Cannot get internal content, because the content is not text." Later on the Internet to find a solution:
    
Copy Code code as follows:

StringBuilder sb = new StringBuilder ();
StringWriter SW = new StringWriter (SB);
HtmlTextWriter HTW = new HtmlTextWriter (SW);
Cell. RenderControl (HTW);

Finally, call Response.Write (sb.) ToString ());

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.