How to anchor a redirect in APS.NET MVC

1

How can I send the user to a certain page block by passing the id in the url. For example: link , how to pass this type in ASP.NET MVC using return RedirectToAction .

The line of my code looks like this: return RedirectToAction("Index", "Home"); , I tried return RedirectToAction("Index", "Home",new{#type}); but it does not accept the "#".

And another question, what is the name of this resource where you pass the "#" in the page url.

    
asked by anonymous 21.06.2017 / 22:09

3 answers

1

This feature is called Ancora, to perform in a redirect in the MVC, instead of RedirectToAction , it follows the correct line of code:

return Redirect(Url.Action("Index", "Home")+"#type");
    
21.06.2017 / 22:23
0

Just use HTML yourself, do so:

The link:

<a href="#idDoElemento">Meu link teste</a>

Your element

<p id="idDoElemento">teste</p>

That is, in the link, type # + the element id that you want the link to point to.

If it is called anchor

    
21.06.2017 / 22:19
0

This feature is called anchor in HTML. You need to create the anchor and then just call it on any link.

Creating the anchor:

<a name="NOME_DA_ANCORA"></a> 

Going to the anchor:

<a href="#NOME_DA_ANCORA">Ir para topo!</a> 
    
21.06.2017 / 22:20