I've tried to get the contents of a div from the code behind but get the above error. I found a previous thread on here where the suggestion was to use .RenderControl which I tried, but it doesn't give full contents of the page, just headings. The user stated
on the previous thread that in the end they
" I've done this by using JavaScript, and getting the innerHTML of a control and populating it in a HTML <input type='text' runat='server' /> control...
and then extracting it in my code-behind, where needed..."
I can get the contents by using JavaScript on the form using the following code, (I've used it to create a 'print area' for the print button, so know it gets all the content)
function GrabHTML() {
var panel = document.getElementById("<%=divPrintArea.ClientID%>");
var Text = document.write('<html><head><title>Referral Form< ...
Go to the complete details ...