Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Smart Navigation Question

Author  Topic 

Billkamm
Posting Yak Master

124 Posts

Posted - 2006-01-18 : 11:48:02
I have web page where I use smart navigation because I have one dropdownlist whose results need to be sent back to the server to populate another dropdownlist.

However, these controls are at the bottom of the page and when the user finally clicks submits if there is a an error with the submission I wish for the page to return to the same page, but to scrolled all the way to the top, so that the displayed error message can be viewed.

If there a way to scroll to the top of the page or temporarily disable and then re-enabled smart nav?

DustinMichaels
Constraint Violating Yak Guru

464 Posts

Posted - 2006-01-18 : 12:44:12
You could probably do this with javascript.


if(document.getElementById)
window.load = onLoad;

function onLoad()
{
if(document.getElementById("<Some ID that should exist if theres an error>")
window.scrollTo(0, 0);
}
Go to Top of Page

Billkamm
Posting Yak Master

124 Posts

Posted - 2006-01-18 : 13:24:08
Thank you Dustin, that is similiar to the solution I came up with. This is what I did:


<% If strMessage <> String.Empty Then %>
<script language="javascript">
scroll(0,0);
</script>
<% End If %>


Ghetto, but it works lol
Go to Top of Page

henrikop
Constraint Violating Yak Guru

280 Posts

Posted - 2006-01-28 : 03:41:52
You could make it better and more functional

http://authors.aspalliance.com/JimRoss/Articles/MaintainScrollPos.aspx

And remember. SmartNavigation is evil! Don't use it. It mingles with other javascript and you'll get strange errors where's it's hard to put a finger on.

Henri
~~~~
The envious praises me unknowingly
Go to Top of Page
   

- Advertisement -