Questions tagged [html.actionlink]

html.actionlink is an HTML Helper in ASP.NET MVC framework. It enables to render an HTML link by using HTML.ActionLink().

With MVC, HTML helpers are much like traditional ASP.NET Web Form controls.

Just like web form controls in ASP.NET, HTML helpers are used to modify HTML. But HTML helpers are more lightweight. Unlike Web Form controls, an HTML helper does not have an event model and a view state. MVC includes standard helpers for the most common types of HTML elements, like HTML links and HTML form elements.

285 questions
3
votes
2 answers

call dropdownlist selected value as @html.action route value

How to call dropdownlist selected value as @html.action route value. I am using following code in my MVC3 razor. I have to dynamically call 'eventid' as dropdownlist selected value. @Html.Action("FirmPassForum", "Conference", new { eventId = 69 })
user2119324
  • 587
  • 8
  • 24
3
votes
1 answer

How do I generate an action link from a model class?

Possible Duplicate: HTML.ActionLink method In my ASP.NET MVC 3 application, I wish to generate an action link from within a model class, corresponding to calling Html.ActionLink in a view. The reason is I need to return links via JSON to…
aknuds1
  • 65,625
  • 67
  • 195
  • 317
2
votes
2 answers

ASP.NET MVC3 - Usage of Html.ActionLink

I need to use the Html.ActionLink in the format: property of the grid.Column specification. My code goes as below: grid.GetHtml( grid.Columns( grid.Column(header: "Column 1", format: (item) => @
VBK
  • 23
  • 7
2
votes
1 answer

MVC 3 - Actionlink - Show/Hide Register if logged in/logged out

How do I: 1. Move the register link "@Html.ActionLink("Register", "Register")" to the home page and 2. Show and Hide it based on if a user is logged in or logged out I saw this tutorial awhile back but I can't find it again -Jonny
J0NNY ZER0
  • 707
  • 2
  • 13
  • 32
2
votes
1 answer

How to display dynamic Html.ActionLink label?

This code works, but displays "Details" for every row of my table: @appsGrid.GetHtml( tableStyle: "table", headerStyle: "head", alternatingRowStyle: "alt", columns: appsGrid.Columns( …
Max
  • 41
  • 3
2
votes
2 answers

How to pass current Url with query strings into Html.ActionLink() function in MVC

On the https://www.willistowerswatson.com/en/press page, select "Exchange Solutions" in the "Services" facet, and note how the query string changes to…
2
votes
1 answer

ActionLink is showing query string instead of URL parameters

My question is very similar other questions. When using an ActionLink in MVC .Net 4.5, I am getting a query string for one parameter, instead of just a URL path. I tried the solution HERE, but it did not work. CODE- Inside RouteConfig.cs - …
A Bogus
  • 3,852
  • 11
  • 39
  • 58
2
votes
1 answer

How to to display validated form and table in same page ASP.NET MVC

I am trying to display both: Validated form and a database table on the same page. Code is below: Create Controller private object charity; // GET: Charities/Create public ActionResult Create() { return View(charity); //Display…
John
  • 117
  • 1
  • 2
  • 13
2
votes
1 answer

I cant receive ActionLink Parameters in controller?

Im working in a C# MVC .Net web project, and I used an ActionLink with a parameter, but I cant read it into the Controller. Actionlink: @model IEnumerable @foreach (var item in Model) { @Html.ActionLink("Eliminar",…
Karlo A. López
  • 2,548
  • 3
  • 29
  • 56
2
votes
2 answers

How do I use a @Html.ActionLink inside a for loop

How can I pass a value of PGId to controller by use a for loop. I want to only use for loop in my case When I use a for loop It's not work fine: for (int i = 0; i < Model.Count; i++) { …
Khiem Nguyen
  • 403
  • 1
  • 8
  • 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

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

pass object through @Html.ActionLink with click

What I'm trying to do is pass the item that was clicked to the controller for editing but the only thing I can pass to the controller is a string. view: foreach (MenuItemViewModel menuitem in category.MenuItemList) {
NNassar
  • 485
  • 5
  • 11
  • 25
2
votes
1 answer

Passing class object with List from the View to the Controller

I have class which contains List: public class Client { public string FirstName { get; set; } public string LastName { get; set; } public List
Addresses { get; set; } } How I can to pass the object of this…
2
votes
2 answers

Passing a GET parameter to ActionLink in ASP.NET

Sorry but I am new to C# and ASP.NET and I saw alot of posts about this problem but I quite didn't get it. I am trying to understand how to pass a GET parameter to an action thru HTML.ActionLink: here is the the URL:…
mzereba
  • 2,467
  • 5
  • 26
  • 40