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
0
votes
1 answer

Image as link to action method

I have a question about using an image as link to a specific action in a controller. I load my images from the database and show them in a view: @foreach(var imgID in Model.DeliverablesIDsList) {
nielsv
  • 6,540
  • 35
  • 111
  • 215
0
votes
1 answer

Display Image on mouse-on hover

I am having this application where I need to have something like, when we bring the mouse over an employee's name, which is an actionlink , it is suppose to show the employee's image. I am trying to do so using MVC, but am till far unable to do…
Novice
  • 558
  • 2
  • 9
  • 21
0
votes
2 answers

ActionLink doesn't generate proper routing url for actions which has two parameters

In the view @Html.ActionLink("Edit", "Edit", new { id = 1, year = 1 }) In the controller // GET: /Forecasts/Edit/5 public ActionResult Edit(int id, short year) { ... } It generated a url like…
anIBMer
  • 1,159
  • 2
  • 12
  • 20
0
votes
2 answers

Why doesnt my @html.actionlink go to the correct link?

Im having a problem with going to the correct link. When im trying to go to index view in template folder it goes to index view in admin folder instead and i cant understand why when the code says it should look for this view in this specific…
user2043267
  • 71
  • 1
  • 12
0
votes
1 answer

@Html.ActionLink helper pointing to current page

Setup: I am using the Html.ActionLink helper to create a tags to my action, Reset, in the controller PasswordReset, in the area Admin. Html.ActionLink calls (EDITED, but still no joy): The calls to Html.ActionLink are in a foreach loop (html…
awrigley
  • 13,481
  • 10
  • 83
  • 129
0
votes
1 answer

Html.ActionLink inline if statement

This is what I have right now which works fine: @Html.ActionLink("Home", "Index", "Home", null, (ViewBag.SelectedPage == CurrentPageEnums.SelectedViewEnum.Home) ? new { @class = "current"} : null) What I'm trying to do is give it an ID as well and…
NNassar
  • 485
  • 5
  • 11
  • 25
0
votes
1 answer

MVC WebGrid Conditional Concate Htlm.ActionLink

I'm trying to concatenate 2 Html.ActionLink in a conditionnal column in a WebGrid. somethings like that : @grid.GetHtml(columns:grid.Columns( grid.Column("AccountNumber"), grid.Column("ContractNumber"), grid.Column("DisplayName"), …
Calagan74
  • 21
  • 6
0
votes
2 answers

HTML.ActionLink to Controller using Ajax to prevent postback

Here is the ASP MVC code in my view. It fires off to the controller and passes assetId and relationshipContext: @Html.ActionLink("Archive", "Archive", new { assetId = Model.ID, relationshipContext = assetTypeRelation.RelationshipContextID }, new {…
einsteinix
  • 1
  • 1
  • 2
0
votes
1 answer

How to clear all anchor styling from @Html.ActionLink

In my MVC application, I have used @Html.ActionLink. I have set their styles to display them like a button, but the problem is that there are stome styles for a, a:link, etc (I mean, all anchor behaviors) in the CSS file, and that is why the links…
Nirman
  • 6,715
  • 19
  • 72
  • 139
0
votes
3 answers

Whats the use of htmlattributes of html.action method

I am new to MVC and using MVC 2.0 in asp.net. This is the content of stylesheet1.css: .h1{color:Red;} This is the content of display.aspx: < head runat="server"> <## Heading ##link href="../../Content/StyleSheet1.css" rel="stylesheet"…
user983854
  • 51
  • 1
  • 7
0
votes
2 answers

Sending data with ActionLink GET call

How should i do this without using the RouteData.Values["id"]; I am using this action call from the view @Html.ActionLink("Post","Create","Post", new {id=item.Id }, null) And this is the Action // GET: /Post/Create public ActionResult…
Darkmage
  • 1,583
  • 9
  • 24
  • 42
0
votes
2 answers

Pass the model value as parameter in html.actionlink Jquery method

I am generating dynamic links using below code in mvc razor views. @foreach (App.Models.Users item in Model ) { @Html.ActionLink("Delete", "DeleteEmp", new { id = item.Id }, new { onclick = "DeleteConfirm()" }) } i want to pass the id or some other…
User_MVC
  • 251
  • 2
  • 7
  • 21
0
votes
2 answers

HTML.ActionLink redirect not stopping with return false in $.ajax()

i've a HTML.ActionLink on view. what i'm doing is i'm making call to $.ajax() function which checks for return true or false from an anction. it hitting the action, returning the desired result true/false. but the problem is when it returns false. i…
Mayank Pathak
  • 3,621
  • 5
  • 39
  • 67
0
votes
3 answers

How to check some criteria before redirection to page using @Html.Actionlink

i have used @Html.ActionLink for moving to one form. I want to check some condition before moving to that page. condition like If user have access rights for that (Edit) page then only he can redirect to Edit page. I'm trying it using jquery but it…
Priyanka
  • 2,802
  • 14
  • 55
  • 88
0
votes
2 answers

How to get URL value in C# MVC and put it in an Html.ActionLink

So I have this page which will show an individual record from a database. So my URL will look like: mysite.com/Vehicle/Edit/1 or it may end it 2,3,4,5 etc.. depending on the record its on. Basically I need a link in this page that will take me to…
Ben
  • 335
  • 3
  • 12
1 2 3
18
19