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

When using MVC, how to call a Controller Action and Pass Text Box values?

How to read from a text box value when using Html.ActionLink so that the value can be passed to the action? I have the below code:
Consumer Key:
The Light
  • 26,341
  • 62
  • 176
  • 258
4
votes
1 answer

How to use ASP.Net -- Html.ActionLink()

Okay, I'm pretty new to ASP.Net / MVC 2. Can anyone explain how to use the Html.ActionLink thing? I understand that the first parameter is the displayed text, but for the second one, what is the action name??
DarkLightA
  • 14,980
  • 18
  • 49
  • 57
4
votes
2 answers

Getting error while using @Html.ActionLink()

Getting error as following.. Compiler Error Message: CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named 'ActionLink' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider…
Sara
  • 93
  • 1
  • 10
3
votes
1 answer

Creating an ASP.Net MVC3 ActionLink with an area

ASP.Net MVC3 is cool and all but I have this question more out of curiosity than programming issues. Say I have an area called 'Cosmos' within which there is a 'StarController' with an 'Index' action. Now, if I had to create an action link to this,…
3
votes
1 answer

@Html.ActionLink not generating link

route : routes.MapRoute("Default", "{controller}/{action}/{id}/{args1}/{args2}/{args3}", // URL with parameters new { controller = "Home", action = "Index", id =…
Dr. Rajesh Rolen
  • 14,029
  • 41
  • 106
  • 178
3
votes
3 answers

MVC5 Ajax.ActionLink Loads New Page Instead of Replacing

I know that similar questions have been asked and answered multiple times; for the life of me I cannot determine what I am missing, please bear with me. I am trying to load a partial view with an editor for an item on the page, and display that…
Scott Baker
  • 10,013
  • 17
  • 56
  • 102
3
votes
1 answer

How do I use an ActionLink with the RouteValueDictionary?

I'm trying to make my URL look like this: http://domain.com/controller/action/123/SomeTextForSEO I tried using an Action Link, but that appends ?company=SomeTextForSEO instead of the company name after a slash. <%: Html.ActionLink("DomainList",…
3
votes
1 answer

MVC4 ActionLink without parameters points to current path

I have a MVC4 Index page that have the following links: @Html.ActionLink("FOO", "Index", "Mil", new { year = String.Empty, id = String.Empty }, null) @Html.ActionLink("BAR", "Index", "Euro", new { year = String.Empty, id = String.Empty }, null) But…
Mr Billy
  • 151
  • 1
  • 2
  • 13
3
votes
2 answers

ASP.NET routes not triggering as I expect

trying to get started with ASP.NET MVC. I encountered a few difficulties while setting up basic routes. My routes are as follows: public static void RegisterRoutes(RouteCollection routes) { …
A D
  • 307
  • 3
  • 21
3
votes
2 answers

Possible to write an Extension Method for ASP.NET's Html.ActionLink() method?

Right now, I'm trying to work around an IE6/7 bug which requires the wrapping of the closing tag with this IE specific comment to make some drop-down menu work: Unfortunately, I cannot inject this…
Pretzel
  • 8,141
  • 16
  • 59
  • 84
3
votes
1 answer

How can I store a useful value in my ASP.NET MVC site's URL and make it propagate?

Let's say I have a simple ASP.NET MVC site with two views. The views use the following routes: /Foo and /Foo/Bar. Now let's say I want to use the URL to specify (just for the sake of example) the background color of the site. I want my routes to be,…
Josh Schultz
  • 8,000
  • 9
  • 32
  • 39
3
votes
1 answer

ASP.NET MVC4 - Different routing for 2 controllers with actionLinks

Okay, I've got this case where I have two controllers: HomeController MathController I want the routing for my HomeController to stay as default:{controller}/{action}/{id}. But I want to access the actions in the MathController with…
3
votes
1 answer

Write URL to custom route in Razor

I have declared custom routes similar to this: ASP.MVC routes without Details action Here is my route: routes.MapRoute( name: "Profile", url: "Profile/{aScreenName}", defaults: new { controller = "Profile", action = "Index", aScreenName…
Paul
  • 693
  • 1
  • 10
  • 25
3
votes
2 answers

ASP.NET MVC4 ActionLink Routes querystring issue

I have a action like public class EmployerController : Controller { public ActionResult Message(string contractorId, int projectId) {....} and a @html.ActionLink as @Html.ActionLink("Message", "Message", "Employer", new { contractorId =…
Dandy
  • 2,177
  • 14
  • 16
3
votes
1 answer

IIS 7.5 ActionLink Resource not found in MVC4

In my MVC application,@Html.ActionLink control works fine in my local machine. The actionlink redirects to the specified action. But when hosted in server, error "Resource not found. Please check the url" occurs. View Code @Html.ActionLink(" ",…
kk1076
  • 1,740
  • 13
  • 45
  • 76
1 2
3
18 19