Home ActionLink to internal path ASP.NET MVC
Reply: 1

ActionLink to internal path ASP.NET MVC

Argentina55
1#
Argentina55 Published in 2017-09-14 01:53:03Z

How can I generate the following link using @Html.ActionLink?

<a href="#MyStore" aria-controls="MyStore" data-toggle="tab">My Store</a>

I know I can use this to create a link to my controller

@Html.ActionLink("My Store", "MyController", new Dictionary<string, object> { { "aria-controls", "MyStore" }, { "data-toggle", "tab" } });

But, I cannot find any overload of ActionLink which does not take an action name... Instead I want an internal link: href="#MyStore".

Argentina55
2#
Argentina55 Reply to 2017-09-14 02:54:59Z

Reading the above comments, it seems that ActionLinks are designed for external links, so I used this instead:

<a href="#@model.Name()" aria-controls="@model.Name" data-toggle="tab">@model.Name</a>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 2.370833 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO