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
5
votes
3 answers

How do you link to an action that takes an array as a parameter (RedirectToAction and/or ActionLink)?

I have an action defined like so: public ActionResult Foo(int[] bar) { ... } Url's like this will work as expected: .../Controller/Foo?bar=1&bar=3&bar=5 I have another action that does some work and then redirects to the Foo action above for some…
5
votes
3 answers

Html.ActionLink value of ViewBag

In ASP MVC C# I putted a List(Cars) in the ViewBag.cars, now I want to make an actionlink with the title of each car, like this: @if (ViewBag.cars != null) { foreach (var car in ViewBag.cars) {

@Html.ActionLink(@car.title,…

francisMi
  • 925
  • 3
  • 15
  • 31
5
votes
1 answer

MVC Html.ActionLink removes empty querystring parameter from URL

I'm using the Html.ActionLink(string linkText, string actionName, object routeValues) overload to send some params to an Action Method.. Sometimes I need to pass an empty parameter value like: ?item1=&item2=value I'm specifying the param in the…
JoeBrockhaus
  • 2,745
  • 2
  • 40
  • 64
5
votes
1 answer

Html.ActionLink to call an action from a different controller that's in a different folder

I've got a simple view that creates a link if a login is successful and is located under /Login:
@Html.ActionLink("Add a new Organization", "AddOrganization", "/Setup/AddOrganizationController", new { id = Session["ID"] },…
SantasNotReal
  • 1,273
  • 6
  • 18
  • 25
5
votes
1 answer

Pass null parameter to controller with ActionLink

I have a view that lists a bunch of categories:
  • @Html.ActionLink("All", "Index", "Products")
  • @foreach (var item in Model.ProductCategories) {
  • @Html.ActionLink(item.Name, "Index", new { id = item.Id },…
Daniel Olsen
  • 1,020
  • 2
  • 15
  • 27
5
votes
1 answer

How to handle FileStream return type in .ajax post?

I am sending JSON object through following code.. Controller returning values in CSV format that should be provide promt to open or save as CSV file. I unable to understand that what exactly code should be write in success: function (result) Link…
Pradeeepk
  • 83
  • 1
  • 6
5
votes
3 answers

How to create an (image) Header logo with MVC(4)

I'm struggling with an Razor syntax with MVC (4), hoping to find someone who can help me with a nice and working solution. I want a clickable logo(image) and created the following code. This works except of two things. I don't see the image display…
RocketRon
  • 105
  • 1
  • 2
  • 5
4
votes
2 answers

ActionLink with multiple classes in ASP.NET MVC3

I'm curious, is it possible to use multiple CSS classes on an ActionLink in MVC3 Razor syntax? The line below appears to load only the first class(btn) and skipps btn_c. @Html.ActionLink("Administration", "Index", "Admin", null, new { @class = "btn…
Ryan Smith
  • 475
  • 1
  • 8
  • 19
4
votes
2 answers

Dynamic Ajax ActionLink RouteValues

I have an ActionLink link this @Ajax.ActionLink("Delete it!", "Delete", new {id = getTheID}, new AjaxOptions { Confirm = "Really?", HttpMethod = "Delete", UpdateTargetId = "ddlRoles" }) and I want to insert the route value "id" on click. The value…
DerApe
  • 3,097
  • 2
  • 35
  • 55
4
votes
2 answers

MVC ActionLink generating different types of links... why?

I'm new to MVC land, and have an app that i'm working on. i have 2 different links with 2 routes in my global which are fairly similiar route 1 routes.MapRoute("Category", "Movies/{category}/{subcategory}", new { controller = "Catalog", action…
Dacrocky
  • 447
  • 5
  • 12
4
votes
2 answers

html.ActionLink(): ViewController stops working if class Attribute is added

I encountered a very weird behaviour in my project today. So I am working on a website which has an admin view an a common user view. The pages are stored in a folder named "Admin" and a folder named "User" under the folder "Views" I started only…
mypsi
  • 113
  • 1
  • 12
4
votes
3 answers

Html.ActionLink in asp.net MVC object value in wrong format

I have a html.actionlink that i wish to display a link to a members profile page like this: http://somesite.com/members/{username} When use the following markup <%= Html.ActionLink(r.MemberName, "profile", new { MemberName = r.MemberName } )%> I…
Jeremy
  • 1,908
  • 3
  • 25
  • 38
4
votes
2 answers

RouteValueDictionary/object problem in mvc ActionLink

so here it goes: I have a html helper which renders ActionLinks with the optional parameters of the current url in it. this html helper also lets you add some more optional parameters as you please and merges them in 1 RouteValueDictionary. …
Stefanvds
  • 5,868
  • 5
  • 48
  • 72
4
votes
2 answers

MVC ActionLink appending route as querystring rather than route values

I have an MVC Action Link: @Html.ActionLink("Update Information", "Index", "Performance", new { performanceid = item.PerformanceId }, null) This action link's href looks like this: /Performance/Index?performanceid=100 In my RouteConfig.cs I have…
4
votes
2 answers

MVC ActionLink html attributes

I want to use ActionLink instead of plain html to popup my modal window but its working fine with plain html tag but not with MVC actionlink please have a look below. from: (working)