Please look closely at the code that Michal has provided you. Note this line:
HttpContext.Current.Server.Execute(pageHolder, output, false);
When a control has any databound content or any output that depends on context (the properties from CMSDesk), session, etc. you must add the control to a Page object and Execute it to get the correct output.