Navigating to specific part of a view in mvc3

I have a requirement to navigate to a specific section of a view when the page is loaded. This is how I ended up doing it.

Controller: In my controller’s action, I am saving the id of anchor tag to be clicked on page load into ViewData.

View: id of the anchor tag to be clicked to navigate within the document is saved in a hidden field. On page load java script function, I am getting the anchor tag from the hidden <p> control and clicking on it to navigate to the desired position.

View

Advertisements