Questions tagged [url.action]

In ASP.NET MVC the URLHelper provides a method called Action that generates a fully qualified URL to an action method by using the specified action name, controller name, route values, and protocol to use.

In ASP.NET MVC, Controllers and Views has a property called Url that exposes a URLHelper type, which help to create URL address.

The URLHelper provides a method called Action that generates a fully qualified URL to an action method by using the specified action name, controller name, route values, and protocol to use, for sample:

<a href="@Url.Action("Create", "Product", new { area = "Sales" })">New Product</a>

See de MSDN documentation.

143 questions
0
votes
0 answers

Action method not getting called when I refresh page (MVC/Javascript)

I have a pop up window which uses the following code to call an action method when a checkbox is checked: window.location.href('@Url.Action("process", "wip")'); This works fine, but I also need the window to refresh itself when the checkbox is…
Nathan R
  • 840
  • 5
  • 13
  • 32
0
votes
0 answers

Passing parameter to @Url.Action

I am trying to pass two parameters through a @Url.Action for a submit button. However, the values are not being passed. I have index view with a dropdown field and a Save button. What I would like for the user to be able to do is select a dropdown…
Ethel Patrick
  • 885
  • 7
  • 18
  • 38
0
votes
1 answer

build routeValues once to reuse in Razor View

I wasn't sure how to title this question. Currently in my Razor view I have the following @Html.ActionLink("Rank -1", "ChangeRank", new { id = item.ID, newRank = (item.UserRank + 1), …
dave317
  • 754
  • 2
  • 12
  • 30
0
votes
1 answer

How to Reject Get method when QueryString is passed

In MVC application My Current Route Config is: routes.MapRoute( "PaymentInformation", "PaymentInformation.aspx/{resNum}", new { controller = "Reservation", action = "Edit", resNum = UrlParameter.Optional } ); It calls below mentioned…
user4956321
  • 313
  • 1
  • 3
  • 15
0
votes
1 answer

Add URL.Action to javascript method in Razor View

I have a question on how to put my Url Action to razor view: @Html.EditorFor(m => m.MyTypes, false, new {id = "myId", onchange = "onMyTypeChange('Url.Action("GetMyFields", "MyController")')"}) Do you have any idea how to fix it ?
mskuratowski
  • 4,014
  • 15
  • 58
  • 109
0
votes
1 answer

How to link Url.Action to a specific controller method

I have a menu with a number of selectable options within the menu, but for some reason if I select any of these items I am always redirected to the controller method of the last action which is the logout page. My code for the list is the…
Maeglin77
  • 173
  • 1
  • 14
0
votes
1 answer

url.action method not resulting in expected URL output

I was working in a sample MVC project, i have used the below url action method and its not going to the URL as expected. I have two views in total- named create and index of person entity. URLs like; app/Person/Create & app/Person/Index. Here person…
pvaju896
  • 1,397
  • 6
  • 25
  • 46
0
votes
8 answers

Can i use "@Url.Action" in c# (Inside .aspx page)

Hi i am trying to add "@Url.Action" in c#.net (WebForms) to resolve the path conflict in server and with my local system using configuration file. i had this line and in this i am trying to use url.action in href property.
thiru
  • 173
  • 1
  • 4
  • 16
0
votes
1 answer

JQuery autocomplete feature Not Working

There are many links on this issue but none of them are helping and I am using the below simple JQuery Code, I have tried with CDN too- google CDN, it is giving same error and my autocomplete functionality not working. Getting this error: Uncaught…
Debanjan
  • 69
  • 1
  • 8
0
votes
1 answer

How to use Url.Action to pass multiple Parameters to Route

I'm just learning MVC and am trying to create a SEO page title, therefore I'm sending an ID for the controller but also the page slug for the SEO. I want to see Recipe/Details/18/foobar but the below code returns Results/Name/18?name=foobar I…
0
votes
1 answer

jQuery/ASP.Net MVC passing id variable to content.load

This will probably be a rather simple question. How do I pass: var ident = $(this).attr("id"); to content.load("@Html.Raw(Url.Action("Action", "Controller", new {id=ident}))"); I've tried: ... new {id="+ident+"}))"); but it doesn't…
Leigh Cooper
  • 158
  • 1
  • 8
0
votes
1 answer

Pass html control values in Url.Action: MVC

I want to pass two parameters in @Url.Action. View: