I am trying to email an entire page of controls in HTML format. This worked flawlessly in 1.1, but after upgrading to 2.0 the rendercontrol command crashes with a "RegisterforEventValidatio
n can only be called during Render(). The HTML side consists of a form that contains the panel "wholeform", and all objects on the page are enclosed in that.
I have already tried setting enableeventvalidation = false in the page directive, and experimenting
with the visibility property of different objects with no success.
Any help would be greatly appreciated. Please be explicit, since I'm no expert. Thanks.
Dim p As New Page 'Create a new Page instance and a server-side form
Dim hf As New HtmlForm
p.Controls.Add(hf) 'Build up the control hierarchy
Dim SB As New StringBuilder
Dim SW As New StringWriter(SB)
Dim htmlTW As New HtmlTextWriter(SW)
p.RenderControl(htmlTW) 'Call the page's RenderControl() method
p = Nothing
strEmailBody = SB.ToString()
... code to email