Sathish,
I observer some points in your code :
1] As we know, Aspx pages processed at server side and then load to browser. So it will clearly hit your PageLoad first then hit to document.ready.
Hence there is no point in using Jquery at client side if you want value in PageLoad event.
2] You have used "MainDiv" div with runat="server", which may change client side id of div.
Hence possibility of error in $('#MainDiv').height(); statement.
Understanding :
1] You have used iframe and used height parameter in %, its correct in case of responsive UI.
Comments :
If you are ready to use the iframe height value in px instead of % you may follow below solution.
This is my POC, Make correction according to your requirement.
ASP :
<form id="form1" runat="server">
<div id="content" runat="server" clientidmode="Static">
<span style="height:30px; width:200px;color:Blue;">This my span...</span>
</div>
<asp:HiddenField ID="hdnMyFld2" runat="server" ClientIDMode="Static" />
<iframe id="ifXyz" runat="server" clientidmode="Static" src="http://google.com" height="300px" frameborder="1" name="mainFrame" />
</form>
C# :
protected void Page_Load(object sender, EventArgs e)
{ // i hope you are interested in value more than wherever i assign it.
hdnMyFld2.Value = Convert.ToString(ifXyz.Attributes["height"]).Replace("px","");
}