I would recommend using jQuery for this, I have done something like this a few times and it makes it very easy.
http://api.jquery.com/load/[
^]
In your example it would be something as simple as:
$("#mydiv").load("pageToLoad.aspx #container");
PageToLoad.aspx:
pageToLoad.aspx:
<html>
<body>
<div id="container">
<!--
</div>
</body>
</html>