J86
J86

Reputation: 15237

Create an action link with #id in .net core

I want to generate a link like this:

http://localhost:5013/Home/Glossary#Agnikumara

I do not mean the id on the resulting anchor tag, like:

<a href="/home/glossary" id="Agnikumara">Link</a>

I want the resulting link to be: http://localhost:5013/Home/Glossary#Agnikumara how do I do that in .NET Core MVC?

I keep searching, but I always get the thing that I don't want, i.e. an id on the actual anchor tag.

Upvotes: 0

Views: 449

Answers (1)

LazZiya
LazZiya

Reputation: 5719

Use asp-fragment

<a asp-controller="Home"
   asp-action="Glossary"
   asp-fragment="Agnikumara">Link</a>

Upvotes: 2

Related Questions