Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

passing section id in mvc using @Url.Action so that user will be scrolled to a particular section after redirecting

I am a web designer but I am told to design static pages in mvc where rather then using href="some url" I have to use href="@Url.Action("Controller", View)" Now I want to pass a section id in the url so when the user redirects it will be scrolled down to that specific section usually in html this is the syntax I use

href="index.html#mysectionid"

in Html I have something Like this

<section id="mysection">

</section>

I want to Know How I am gonna do this thing in mvc. Thanks

like image 959
Abdul Hannan Avatar asked Jun 09 '16 13:06

Abdul Hannan


1 Answers

You can mix C# code with normal html in Razor:

<a href="@Url.Action("Contact", "Home")#mysection">Test</a>
like image 71
Shyju Avatar answered Nov 15 '22 04:11

Shyju