We help IT Professionals succeed at work.

hyperlink on the same page

shpresa asked
Hi I have this menu on asp.net and wanted to know if it is possible move the page down when the subsection is explained. For example, I have a section down the the same page about "success stories" and when clicked on the link, i need the page to go down to that section (in the same page)

Can you help with any javascript or CSS or Asp.net coding to make that happen?

<asp:MenuItem NavigateUrl="~/Default.aspx" Text="About Us"/>
                        <asp:MenuItem NavigateUrl="~/test1.aspx" Text="Success Stories"/>
                        <asp:MenuItem NavigateUrl="~/test2.aspx" Text="Why Us"/>

down the page I have:
  <div id="SuccessStories" class="SuccessStories">
<p> here is the subsection of success stories
Watch Question

I think you need something like this, but it depends from the location of initial menu and the element. Default.aspx  and test1.aspx don't look like same page.
<asp:MenuItem NavigateUrl="~/test1.aspx#Stories" Text="Success Stories"/>
<div id="SuccessStories" class="SuccessStories">
<a id="Stories"> </a>
<p> here is the subsection of success stories
Most Valuable Expert 2018
Distinguished Expert 2019
No need to add a new element - just append the id of the section to the link:

<asp:MenuItem NavigateUrl="~/test1.aspx#SuccessStories" Text="Success Stories"/>

Open in new window