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
10
votes
4 answers

Create a T4MVC ActionLink with url fragment

Is there a way to create a strongly typed T4MVC ActionLink with a hash/pound/fragment in it? For example, here is the link I'd like to create: Feed me But there's no extension to the T4MVC object that can do this. <%=…
Dan Atkinson
  • 11,391
  • 14
  • 81
  • 114
10
votes
3 answers

Get current action and controller and use it as a variable in an Html.ActionLink?

I need to be able to dynamically retrieve the current action and controller name of whatever page you're on, and actually use them to create a new HTML.ActionLink that links to the same action and controller name, but in a different area. So I guess…
EPM
  • 171
  • 1
  • 5
  • 16
9
votes
1 answer

How to call the Route Name in Html.ActionLink asp.net MVC?

I have this route routes.MapRoute( "ViewGames", // Route name "psp/{controller}/{action}", // URL with parameters new { controller = "Games"} // Parameter defaults ); and I used <%= Html.ActionLink("God…
idontknowhow
  • 1,507
  • 5
  • 17
  • 23
8
votes
2 answers

ASP MVC3 insert html tag inside actionlink

I'm new to the ASP MVC3 and I'm using Razor Engine. My broplem is that I've build my main navigation in form So how I can do this with the actionlink? I just need to insert b tag inside a…
joonasj
  • 551
  • 2
  • 6
  • 19
7
votes
3 answers

MVC3 Html.ActionLink Post

I have an MVC3 C#.NET web app and need to call a view using Html.ActionLink. I can't tell from the documentation if I can specify the POST or GET. Below is my HTML, is there a way to specify GET or POST? @Html.ActionLink("Create New", "Edit",…
MikeTWebb
  • 9,149
  • 25
  • 93
  • 132
7
votes
3 answers

How to pass routeValues that contains hyphen via actionlink in asp.net mvc 5

I have an actionlink in view, I need it to pass parameter containing hyphen (-). Changing the name convention is not possible. How do I do this?
  • @Html.ActionLink("abc", "abc", "abc", new { area = "",sap-ie="Edge" }, new { id =…
  • Daniel W
    • 1,092
    • 1
    • 12
    • 25
    6
    votes
    3 answers

    I'm seeing strange ActionLink behaviour, why is the url displayed in the browser not displaying the seemingly correct controller?

    I have the following ActionLink: @Html.ActionLink("Upload", "Upload", "File") yet when I hover over the link, the url displayed in the browser is http://localhost:44334/Upload. Where is the controller in this url? Strangely, clicking the url takes…
    ProfK
    • 49,207
    • 121
    • 399
    • 775
    6
    votes
    5 answers

    How do I insert an image using HTML.ActionLink?

    how to insert image in html.actionlink - asp.net mvc? i did it so, but it doesnt works. "> searchPage
    r.r
    • 7,023
    • 28
    • 87
    • 129
    6
    votes
    3 answers

    ASP.NET MVC 4 Passing Object Variable Through ActionLink

    I have an ASP.NET MVC 4 application. There is a razor view in my application that works with List type as a model. @model List @{ Layout = null; } . . . I am iterating through Model variable like this: @foreach…
    Umut Derbentoğlu
    • 1,146
    • 5
    • 18
    • 39
    6
    votes
    1 answer

    Html.ActionLink() not working for passing a C# object

    I'm trying to pass an object through an ActionLink to a method in an MVC controller. The razor syntax: @Html.ActionLink("Export to Excel","ReturnExcelOfViewableResponses",new { SearchObject = Model.SearchObject}) What's actually being displayed in…
    levininja
    • 3,118
    • 5
    • 26
    • 41
    6
    votes
    2 answers

    Using Knockout bindings in MVC ActionLink

    I am attempting to utilise KnockoutJS and MVC 4 in order to display a table with ActionLink definitions in the first column of the table. Displaying the data itself is extremely straight-forward and I'm not having any problem there. The problem I…
    5
    votes
    2 answers

    Pass List from actionlink to controller method

    In my controller I have this: ViewBag.lstIWantToSend= lstApps.Select(x => x.ID).ToList(); // creates a List and is being populated correctly I want to pass that list to another controller.. so in my view I have: @Html.ActionLink(count,…
    Grizzly
    • 5,873
    • 8
    • 56
    • 109
    5
    votes
    3 answers

    Edit links in GridModel (MVCContrib)

    MvcContrib GridModel : Is it possible to do ActionSyntax in a GridModel I've read this article and it's quite useful but I can't apply this. I don't know if in the newest MVCContrib, they removed the ".Action()" because somehow I cannot access…
    DucDigital
    • 4,580
    • 9
    • 49
    • 97
    5
    votes
    1 answer

    putting @Html.DisplayFor in @Html.ActionLink

    in asp.net mvc, I have a view with name index that show one html table as a grid. suppose this is this my html table: @foreach (var item in Model) {
    Caption
    Pezhman Parsaee
    • 1,209
    • 3
    • 21
    • 35
    5
    votes
    2 answers

    MVC 4 Ajax.Action link won t work

    I am trying to make a MVC website with Ajax call. I have no problem using directly jquery, but when i use @Ajax.ActionLink, i don't get the result i want. Here is my view: