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

ASP.NET MVC Html.ActionLink result URL - the way of encoding

I create an amount of actions in MVC controllers. public ActionResult DoSmth1(string token) public ActionResult DoAnother2(string token) And when I have to call ActionLink.. =Html.ActionLink( x=> x.DoSmth(item.property),…
Sketch
6
votes
2 answers

Ajax.ActionLink is not POSTing

I am trying to navigate to an MVC action by POSTing rather than GETting. (The action is a DELETE, and I don't want it reachable by an external link.) I am using a link in a grid generated by Ajax.ActionLink("Remove", "Delete", new { saID =…
Dave Hanna
  • 2,491
  • 3
  • 32
  • 52
6
votes
1 answer

MVC Html.ActionLink ignores the Controller parameter

I have a a view that has the following code:

<%= Model.Company.CompanyName %>

Projects

    <% foreach (Project p in Model.Company.Projects) { %>
  • <%= Html.ActionLink(p.ProjectName,"Details", "Projects",…
user270748
6
votes
3 answers

How to pass multiple parameters (some complex objects) with Html.ActionLink

I'm working with MVC in .net 4.0. I have a basic Html.ActionLink and I wish to pass multiple parameters to the controller/action. Every time I debug the ActionResult only ONE of my parameters comes through and the other is null (depending on which…
ArdAtak
  • 239
  • 2
  • 4
  • 17
6
votes
4 answers

why a # character is added to the url?

I have a simple page displaying thumbnail list , I want to to add a pager , i have added two action links
  • @Html.ActionLink("Next", "Paginate", "Home", new { nbSkip = ViewBag.nextSkip }, null)
  • when i click on…
    Mouadh
    • 289
    • 1
    • 3
    • 12
    6
    votes
    2 answers

    How to create an ActionLink with Properties for the View Model

    I have a ViewModel with a Filter property that has many properties that I use to filter my data Example: class MyViewModel : IHasFilter { public MyData[] Data { get; set; } public FilterViewModel Filter { get; set; } } class…
    DaveShaw
    • 52,123
    • 16
    • 112
    • 141
    5
    votes
    2 answers

    MVC ActionLink how to specify text, actionname, controller and htmlattributes

    I have been trying to do an actionlink like:
  • @Html.ActionLink("Home", "Index", "Invoice", new { id = "homelink" })
  • So what I have is linkText, an actionname, a controller name and an id for the link. However there is no signature that…
    AnonyMouse
    • 18,108
    • 26
    • 79
    • 131
    5
    votes
    3 answers

    $(document).ready in ascx page after ajax callback

    I'm having a little problem with this setup here I have a list of .ascx files and they all do different tasks in terms of calculations to the controller itself. So on my .aspx page I click on an Ajax.ActionLink() and this will render that specific…
    Ayo
    • 1,198
    • 2
    • 16
    • 36
    5
    votes
    3 answers

    MVC 3 Ajax.ActionLink not working

    I'm playing around with the some MvcMusicStore example based shop and having some problems with the MVC3 Ajax.ActionLink / Ajax.RouteLink helpers. The problem is that it simply does not generate an Ajax request (Request.IsAjaxRequest() == false).…
    5
    votes
    1 answer

    How to override the ActionLink behavior

    Ok, I want to add some security to my site via the ActionLink method. If the user has enough rights to access the action/controller then the ActionLink should render the link. If not, It should return an empty string. Now, the ActionLink is a static…
    Marco Bruggmann
    • 605
    • 2
    • 12
    • 23
    5
    votes
    3 answers

    How do you set the title attribute of an ASP.NET MVC Html.ActionLink to the generated URL

    I would like users to be able to see the corresponding URL for an anchor tag generated by Html.ActionLink() when they hover over the link. This is done by setting the title attribute but where I'm stuck is figuring out how to get that…
    Keith Hill
    • 194,368
    • 42
    • 353
    • 369
    5
    votes
    2 answers

    Html.ActionLink with id value from a dropdownlist

    I've got a dropdownlist: <%= Html.DropDownList("ddlNames", new SelectList(Model.NameList, "ID", "Name"))%> I've got an ActionLink: <%: Html.ActionLink("edit", "Edit", "Members", new { area = "MembersArea", id = XXX }, null)%> I want the value of the…
    Filip
    • 1,098
    • 5
    • 17
    • 34
    5
    votes
    1 answer

    ASP.NET MVC ActionLink with LinkText = absolute URL

    <%: Html.ActionLink("Share Me", "Index", "Mall", new { username = Model.Username }, null)%> results as expected according to mapped routes: Share Me I however need it to not say Share Me but to show the absolute URL,…
    Nick Spiers
    • 2,344
    • 2
    • 19
    • 31
    5
    votes
    2 answers

    mvc ajax.actionlink with jquery dialog confirm

    I have a table with some rows of data items. For each row it will be some actionlinks that will call some methods (delete dataitem, change status dataitem etc...) Before each user clicks the button i want a jquery dialog to show up and give the user…
    Webking
    • 1,822
    • 2
    • 20
    • 28
    5
    votes
    2 answers

    ActionLink route values containing specific characters

    I am using this action-link to send a route value id to controller but my id value like this config.xml and here is my action-link @Html.ActionLink("Destroy", "DeleteFile", "Files", new { id = "config.xml"}) The question is when I want to click…
    Younis Qadir
    • 315
    • 1
    • 4
    • 16