Thanks for responding. I am not sure how to do this. Do you know of
a link or something that could help?
Steve
Steve,
I am including some code as a sample:
First is the code for a sample page. The important part is the
validateRequest="false" which is part of the @Page tag. Since you will be
placing HTML into a hidden field ASP.NET will check these field to ensure
that hackers are not messing up your HMTL. In this example and perhaps in
what you are doing this is ok to set to false since you know that it is you
that is doing this.
This is the markup for the page.
<%@ Page Language="VB" validateRequest="false" debug="true"
AutoEventWireup="false" CodeFile="TestGetHTML.aspx.vb"
Inherits="TestGetHTML" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<script language="javascript">
function SetHMTLToHidden()
{
debugger;
var temp;
var hidden;
temp=document.getElementById('AllTheHTML');
hidden=document.getElementById('HiddenField1');
hidden.value=temp.innerHTML;
}
</script>
<form id="form1" runat="server">
<div id="AllTheHTML">
<table style="width: 656px; height: 176px">
<tr>
<td style="width: 100px">Cell 1</td>
<td style="width: 100px">Some text</td>
<td style="width: 100px"></td>
</tr>
<tr>
<td style="width: 100px"></td>
<td style="width: 100px"></td>
<td style="width: 100px">The middle</td>
</tr>
<tr>
<td style="width: 100px">Cell3</td>
<td style="width: 100px">Somemore text</td>
<td style="width: 100px"></td>
</tr>
</table>
<br />
<asp:HiddenField ID="HiddenField1" runat="server" />
<br />
<asp:Button ID="Button1" runat="server"
OnClientClick="SetHMTLToHidden();" Text="Button" />
</div>
</form>
</body>
</html>
This is a sample of a code behind which gets the HTML from the hidden field
and then you do with it as you want.
Partial Class TestGetHTML
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim txt As String
txt = Me.HiddenField1.Value
End Sub
End Class
Hope this helps
Lloyd Sheen