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
337
votes
23 answers

Html.ActionLink as a button or an image, not a link

In the latest (RC1) release of ASP.NET MVC, how do I get Html.ActionLink to render as a button or an image instead of a link?
Ryan Lundy
  • 204,559
  • 37
  • 180
  • 211
264
votes
10 answers

HTML.ActionLink method

Let's say I have a class public class ItemController:Controller { public ActionResult Login(int id) { return View("Hi", id); } } On a page that is not located at the Item folder, where ItemController resides, I want to create a…
Graviton
  • 81,782
  • 146
  • 424
  • 602
177
votes
12 answers

Putting HTML inside Html.ActionLink(), plus No Link Text?

I have two questions: I'm wondering how I can display no link text when using Html.ActionLink() in an MVC view (actually, this is Site.Master). There is not an overloaded version that does not allow link text, and when I try passing in just a…
Matt
  • 23,363
  • 39
  • 111
  • 152
122
votes
4 answers

What's the difference between RouteLink and ActionLink in ASP.NET MVC?

I think that the title pretty much sums it up: What's the difference between RouteLink() and ActionLink() in ASP.NET MVC? i.e. when do you use Html.RouteLink() and when do you use Html.ActionLink() in your View?
Guy
  • 65,082
  • 97
  • 254
  • 325
104
votes
17 answers

ASP.NET MVC ActionLink and post method

Can anyone tell me how can I submit values to Controller using ActionLink and POST method? I don't want to use buttons. I guess it has something with jquery.
šljaker
  • 7,294
  • 14
  • 46
  • 80
103
votes
11 answers

Delete ActionLink with confirm dialog

I'm trying to implement a simple ActionLink that will delete records using ASP.NET MVC. This is what I have so far: <%= Html.ActionLink("Delete", "Delete", new { id = item.storyId, …
Cameron
  • 27,963
  • 100
  • 281
  • 483
89
votes
3 answers

ActionLink htmlAttributes with hyphens

This works Edit But this doesn't. Why? @Html.ActionLink("Edit", "edit", "markets", new { id = 1…
Pavel Hlobil
  • 1,762
  • 1
  • 15
  • 22
46
votes
9 answers

asp.net mvc Html.ActionLink() keeping route value I don't want

I have the following ActionLink in my view <%= Html.ActionLink("LinkText", "Action", "Controller"); %> and it creates the following URL http://mywebsite.com/Controller/Action Say I add an ID at the end like so:…
codette
  • 12,343
  • 9
  • 37
  • 38
42
votes
3 answers

ASP.NET MVC 3 (Razor) Ajax.ActionLink - What am i doing wrong?

Trying to have a AJAX action link which when clicked, should do a HttpGet to an action method which returns a PartialViewResult and shoves the HTML into a div. Here's my View:
@Ajax.ActionLink("Show Admin…
RPM1984
  • 72,246
  • 58
  • 225
  • 350
41
votes
6 answers

ASP.NET MVC - Pass array object as a route value within Html.ActionLink(...)

I have a method that returns an array (string[]) and I'm trying to pass this array of strings into an Action Link so that it will create a query string similar to: /Controller/Action?str=val1&str=val2&str=val3...etc But when I pass new { str =…
Mike
41
votes
1 answer

ASP.NET MVC add css class to actionlink

How do I add a css class to this actionlink? I have read you do it something like new { class = button } but I'm not sure where to put it within my actionlink: <%= Html.ActionLink("View Performances", "Details", "Productions", …
Cameron
  • 27,963
  • 100
  • 281
  • 483
41
votes
4 answers

Html.ActionLink with a specified HTML id?

I'd like to give the like generated with an Html.ActionLink an HTML id so I can change the CSS depending on where I am. I have a MasterPage with a set of links and I'd like to distinguish the active "Tab" with Jquery changing the css of that active…
Peter
  • 685
  • 3
  • 9
  • 14
34
votes
3 answers

Create an ActionLink with HTML elements in the link text

In an ASP.NET MVC view I'd like to include a link of the form: Link text with further descriptive text Trying to include the element in the linkText field of a call to Html.ActionLink() ends up with it being…
Giraffe
  • 1,993
  • 3
  • 20
  • 20
30
votes
3 answers

ActionLink with multiple parameters

I want to create a URL like /?name=Macbeth&year=2011 with my ActionLink which I have tried doing like so: <%= Html.ActionLink("View Details", "Details", "Performances", new { name = item.show }, new { year = item.year })%> but it doesn't work. How…
Cameron
  • 27,963
  • 100
  • 281
  • 483
28
votes
1 answer

ASP.NET MVC - How to get an URL instead of an action link?

I want to embed a URL in an applet parameter. The only way I know to create automatically the URL is Html.ActionLink(), but I want only the inner HREF attribute, not the whole link. Is there another way to get what I wan't, other that using Regex on…
user2173353
  • 4,316
  • 4
  • 47
  • 79
1
2 3
40 41