Instead of creating StringBuider and StringWriter, I think using helper.ViewContext.writer will work.
Then the above code example will look like this:
var calendar = new DayPilotCalendar();
if( model != null )
{
model.CopyTo( calendar );
}
if( options != null )
{
options.CopyTo( calendar );
}
HtmlTextWriter writer = new HtmlTextWriter( helper.ViewContext.Writer );
writer.AddAttribute( HtmlTextWriterAttribute.Class, "dayPilot" );
writer.RenderBeginTag( HtmlTextWriterTag.Div );
calendar.RenderControl( writer );
writer.RenderEndTag();
return( null );
: helper.ViewContext.Writer <UL> . . , .