I want to create a custom actionlink but I don't know how to do this while fulfilling my needs. I worked with custom htmlhelpers before but this is a bit more tricky for me.
The actionlink
that I want to call needs to be like this:
@Html.CustomActionLink("LinkText", "Area","Controller","TabMenu","Action",routeValues, htmlAttributes)
so an example would be:
@Html.CustomActionLink("Click here","Travel","Trip","Index","Index", new { par1 = "test", par2 = test2, new { @class = "font-color-blue" })`
Which would generate this html:
<a class="font-color-blue" href="/Trip/Travel/Index/Index?par1=test&par2=test2">Click Here</a>
And my route looks like:
context.MapRoute(
"EPloeg_default",
"EPloeg/{controller}/{tabmenu}/{action}/{id}/{actionMethod}",
new { action = "Index", id = UrlParameter.Optional, actionMethod = UrlParameter.Optional }
);
Any ideas how I can make this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…