Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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