I'm building an ASP.NET MVC site where I want one of the Views I return to be automatically scroll to a certain point.
The part of the site where I want this to occur works sort of like a forum - there are "threads" that contain "posts". A user can either browse to the whole paginated thread or can browse to a specific post, using its ID. When a user browses to a specific post, I want to show the regular thread interface, then browse to the page that the post is on and scroll down to the post.
Is it possible to somehow automatically scroll down to a certain point when returning a View from an action in an ASP.NET MVC site? If so, how do I do this?
NOTE: One solution to this problem that I've found is how Stack Overflow and the other Stack Exchange sites do it: each answer to a question can be linked to by adding #ID
to the URL. If it's impossible to automatically scroll down when returning a View, I would implement this instead, but I don't understand how to use such an approach when there are multiple pages and the post in question isn't on the current page.
UPDATE:
Based on Chris' answer, I'm currently planning to implement it with the URL looking like this: example.com/forum/[ForumID]/thread/[ThreadID]/post/[PostID]#[PostID]
. In my Action, I figure out what page of the Thread the Post is on, and then I return all the Posts from that page to the View.
However, I noticed something special in how Stack Overflow solves this problem. Try going to: http://meta.stackoverflow.com/questions/57170 - it ends up sending you to http://meta.stackoverflow.com/questions/57155/gravatar-bugs-and-improvements-in-chat/57170#57170.
How is the above implemented? This is exactly what I want to accomplish.