<html>
<head>
<title>some title</title>
<script type="text/jscript">
function setDivCode(myCode)
{
var myDiv = document.getElementById('div1');
myDiv.innerHTML += myCode;
}
</script>
</head>
<body>
<input type="text" id="txt" value="<b>here is my code</b>"/>
<input type="button" id="btn" onclick="setDivCode(txt.value);" />
<div id="div1">
<a href="http://www.google.com" id="lnk">google</a>
</div>
</body>
</html>
<div id="div1" runat="server">
</div>
div1.InnerHtml
....
<table>
<tr>
<td id="myTD" runat="server">
</td>
</tr>
</table>
....
HtmlGenericControl div2 = new HtmlGenericControl("div");//DIV declaration
protected void Page_Load(object sender, EventArgs e)
{
div2.ID = "div2";
HtmlButton btn = new HtmlButton(); //put some DIV controls just to see if it's there
btn.ID = "btn1";
div2.Controls.Add(btn);
myTD.Controls.Add(div2);// Add it to the TableCell
}
protected void Button1_Click(object sender, EventArgs e)
{
//Here is, remove the DIV.
myTD.Controls.Remove(div2);
}
}