Reputation: 1253
How do I set the scrollbars in an ASP.net page dynamically? When a user comes to certain pages on my site I would like the page to be scrolled down about halfway. Is there a way to do this without using Javascript?
Upvotes: 1
Views: 670
Reputation: 6524
Sounds like you're looking for an anchor tag. You specify the URL as www.site.com/page.aspx#middle
Then in your page, you put the tag where you want them to scroll to
<a name="middle" />
http://www.w3schools.com/tags/tag_a.asp
Upvotes: 1
Reputation: 48686
Something you might be interested in that I've used successfully on projects before is the smartScroller. You can place this control on a web page and the web page will automatically remember the scroll position between postbacks and scroll there. Check it out: https://web.archive.org/web/20211020140248/https://www.4guysfromrolla.com/articles/111704-1.aspx
It does use javascript though. Any reason in particular you don't want to use javascript?
Upvotes: 0
Reputation: 10847
asp.net is a server side technology so it is not possible to manage the scroll position without using javascript. At least I have not seen it done.
Upvotes: 0
Reputation: 126864
One standard HTML option is to set a target <a name="foo"></a>
on your page. Links to the page would need to be /yourpage.aspx#foo
, but that would cause the browser to scroll to the target.
Upvotes: 4