views:

67

answers:

2

I'm using the technique described here to render a User Control to a string and it all works fine when the control contains just plain HTML, but when I try adding some server controls to the UC (like asp:button) I get the following error when calling server.execute:

"Error executing child request for handler 'System.Web.UI.Page'."

any ideas why/how to fix it? thanks.

A: 

Could you try to include a call to EnsureChildControls() before to render to a string. This way you force the page to render the entire control tree first.

Colin
+1  A: 

The problem was that the UC should have been added to the form's control collection, not the page's.