0

What is the best way to write/output html in a webpart?

I am coming from PHP, there it was pretty straightforward.

I have seen the HtmlTextWriter, but I think that is very odd and makes it even more complicated.

Thank you!

1 Answer 1

2

If you just want to output HTML directly using code then you should override the RenderContents Method and call the methods on the HtmlTextWriter it gets as parameter.

But many prefer to use ASP.NET controls which should be created inside an override of CreateChildControls Method

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.