Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: how to jump to bottom of a page in a postback


Message #1 by "Charles Shadle" <cpshadle@h...> on Tue, 14 Jan 2003 03:16:05
Please excuse what may be simple. 

I want to load in my webpage showing the top of the page as normal but 
when I do a postback, I want the user to be viewing the bottom of the 
page.  

I know that I can put a bookmark in to go there, but that would sort of 
defeat the purpose of the code.  Any help would be much appreciated. 
Message #2 by "Charles Shadle" <cpshadle@h...> on Tue, 14 Jan 2003 17:02:59
Thanks to all.

I was given the heads up on SmartNavigation.  I did some reading and am 
excited to try it out.  I also read about some errors/difficulties and 
since it's only good for >=IE 5.0, I think that for the time, this 
probably is not the right choice for this project.

http://www.reflectionit.nl/InitialFocus.aspx also had some code to set 
the initial focus which I suppose given time, could easily be altered, 
but time is always in short supply.

I coded in the jscript below, kicked it around some, and was pleased that 
it appears to work fine.  I think that for the time this is what I'll go 
with.  

Thanks to all... 

(from Kieth5000 at http://www.asp.net/Forums/)
==================
.aspx page
==================
...
<body>
  ...
     <!-- bottom of page -->
     <asp:Panel  ID="Bottom_pnl"  Visible="false"  runat="server">
          <a id="BottomAnchor_a"></a>
          <script language="javascript">
   document.all.BottomAnchor_a.scrollIntoView()
          </script>
     </asp:Panel>
</body>
...



==================
.vb file
==================
sub Page_Load()
     if (Page.IsPostBack)
          Bottom_pnl.Visible = true
     end if
end sub



  Return to Index