Hi:
Here's a piece of code that will force the iframe page to go to the top of the site when a link inside of an iframe page is clicked. This really helps when you scroll down an iframe page, and then click on a link within the page. Normally the page in the iframe updates but the "portal" will not return to the top of the page. This helps fix that problem.
Add this piece of javascript to the ascx page of the iframe module.
<script language="javascript" type="text/javascript">
function chi_setiframepagetotop() {
try {
if (document.body && document.body.scrollTop) document.body.scrollTop=0;
if (document.documentElement && document.documentElement.scrollTop) document.documentElement.scrollTop=0;
if (window.pageYOffset) window.pageYOffset=0;
}
catch(e)
{}
}
</script>
<asp:Label id="lblIFrame" Runat="server" EnableViewState=False></asp:Label>
Chane this in the code behind file. To add in the :
onload=chi_setiframepagetotop()
code to the frame string builder. such as:
Dim FrameText As New StringBuilder
FrameText.Append("<iframe onload=chi_setiframepagetotop() frameborder=""")
FrameText.Append(CType(Settings("border"), String))
FrameText.Append(""" src=""")
FrameText.Append(AddHTTP(src))
FrameText.Append(""" height=""")
FrameText.Append(CType(Settings("height"), String))
FrameText.Append(""" width=""")
FrameText.Append(CType(Settings("width"), String))
FrameText.Append(""" title=""")
FrameText.Append(CType(Settings("title"), String))
FrameText.Append(""" scrolling=""")
FrameText.Append(CType(Settings("scrolling"), String))
FrameText.Append(""">Your Browser Does Not Support Frames</iframe>")
lblIFrame.Text = FrameText.ToString
Hope this helps someone out.