Questions tagged [actionlink]

In ASP.NET MVC, the ActionLink method renders an element that links to an action method in a controller. Specifically, it returns an anchor element ( tag) that contains the virtual path of the specified action method (possibly with route parameters).

In ASP.NET MVC, the ActionLink method renders an element that links to an action method in a controller. Specifically, it returns an anchor element ( tag) that contains the virtual path of the specified action method (possibly with route parameters).

LinkExtensions.ActionLink Method
http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.actionlink.aspx

605 questions
2
votes
1 answer

How to pass parameter to controller using actionlink

I need to pass a view data(integer) to another controller. This is what i tried; @Html.ActionLink("Get Location", "Index", "Map", new { Id=@item.Id},null) i need to pass this information to "Map" Controller's Index action method; public…
Thilina De Silva
  • 391
  • 2
  • 13
  • 25
2
votes
1 answer

@Html.ActionLink is not linking to current area by default

I have 2 areas Admin and FrontEnd (in that order). When I am in a view in my FrontEnd area, ActionLink always points to the Admin area: @Html.ActionLink("Checkout", "Address", "Checkout") Will be http://localhost:53600/admin/Checkout/Address but…
webnoob
  • 15,747
  • 13
  • 83
  • 165
2
votes
1 answer

ASP.NET MVC - creating and handling with URLs with Greater Than and Less Than characters

Consider a link to a page for a user's profile. A page is creating that URL like this: //Model.Name has value "" Html.ActionLink("foo, "ViewUser", new { id=5, title=Url.Encode(Model.Name) }) The actual outcome…
p.campbell
  • 98,673
  • 67
  • 256
  • 322
2
votes
1 answer

Attribute Routing - Strongly Typed Action Links

I am currently using the standard routing config and T4MVC for my ActionLinks like so: routes.MapRoute("Default", "{controller}/{action}", new { controller = "Home", action = "Index", id = "" }, new[]…
2
votes
1 answer

Using Action link with Web Api Controller

How can I use ActionLink when calling an action on a controller that is a WebApi controller. public class RequestController : ApiController { [ActionName("CreateAction")] [ResponseType(typeof(Request))] public async…
Jawahar
  • 183
  • 4
  • 16
2
votes
2 answers

Html Action link not taking me to the correct page

On my Home/index page which is returned by my home controller, I have added an HTML Action Link: @Html.ActionLink("Create Ticket", "Create", "CustomerTicketInfo", new { @class = "btn btn-default" }) When clicked it should take me to a Create…
EB.
  • 2,627
  • 8
  • 35
  • 55
2
votes
1 answer

Ajax.ActionLink does not work when OnBegin is true

I intend to call function when clicked on ActionLink and depending on the ouptput of the function would either go the next page or show alert. When OnBegin is true in Ajax.ActionLink, it should hit the controller method and hence go to specified…
Nands
  • 379
  • 3
  • 19
2
votes
1 answer

How to manipulate Html.ActionLink to show a link to another controller?

In the Details view of the HomeController, I'd like to create a link to the Email view on the MiscController. In addition, I need to add an item to the QueryString. I'd like to create a link that goes something like:
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
2
votes
1 answer

How can I link to the root of the site with Html.ActionLink?

I have this ActionLink to login: @Html.ActionLink("Login", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) From the Home view, it works, resulting in this url: http://localhost:12676/Account/Login But then, when…
user1911
  • 680
  • 1
  • 14
  • 36
2
votes
1 answer

Html.ActionLink() gives me an empty link when I use it inside Html.RenderAction()

I have a Microsoft MVC project with an action "Foo" whose view ("Foo.aspx") contains the lines: <%= Html.ActionLink("mylinktext1", "bar") %> <%= Html.ActionLink(x => x.Bar(), "mylinktext2") %> When I hit this from a web browser or…
Brian Kendig
  • 2,452
  • 2
  • 26
  • 36
2
votes
3 answers

Should Html.Encode be called when building ActionLinks in ASP.NET MVC

If the name of a link is pulled from the database, should you be calling the Html.Encode method to clean the name? For example: Html.ActionLink(Model.PersonFromDB.FirstName, "Action", "Controller", new…
Chris F
  • 2,886
  • 2
  • 28
  • 33
2
votes
4 answers

ASP.NET MVC ActionLink: Strange URL generated

Why does the following Html.ActionLink call: Html.ActionLink("Approve", "Advance", new { id = Model.ID, step = StepType.Approve }) generate a URL with query parameters rather than a "restful" URL,…
Neil Barnwell
  • 41,080
  • 29
  • 148
  • 220
2
votes
3 answers

Ajax.Actionlink output with id attribute

I'm using the Ajax.Actionlink from the MVC framework and everything works fine with my targets and partial views. However I've seen that the html output doesn't add the "id" attribute to the resulting tag. Is there any way how I can…
cer
  • 21
  • 1
  • 3
2
votes
2 answers

%20%20... is being added to end of actionlink

I'm trying to create a link to edit each entry in a web grid but when I click on the link it append "%20%20%20%20%20%20%20%20%20%20%20%20%20" to the end of the url. I have no idea why this is happening. The link works find if I remove the…
Antarr Byrd
  • 24,863
  • 33
  • 100
  • 188
2
votes
3 answers

URL-encode parameters in ActionLink?

I have the following route registered; routes.MapRoute( "LocationsByArea", "Locations/{system}/{storage}/{area}", new { controller =…
Erik Z
  • 4,660
  • 6
  • 47
  • 74