c# - ActionLink doesn't make correct with URL, but RouteLink does with attribute routing -
Sometimes I This is my most recent move, with this: Looking at this setup, I expect me This produces the expected URL. On this same scene, I have a link to another action with a I have checked (many times) that the parameters near me are correct, and the RouteLink will work > is starting with the first viewing snippet: This slice uses the overload of the method: The following H The result in TML is: I found that if the current request has been done through the This results in the following HTML: However, it does not seem to work while trying to take any action in a separate controller. To use surcharges with those standards, which you intended to provide, use one: If you are not using it, Code> null is OK to pass This, The expected anchor produces the element and because the name of the controller is specified, it also works while referring to a controller through which the current request was not routed. ActionLink refuses to create the correct URL with placeholders in my application, But when I specify the
name on the
root attribute, it generates the url properties.
[RoutePrefix ("RuleConfiguration")] Public class RuleConfigurationController: EntityController & LT; RuleConfigurationModel, RuleConfiguration & gt; {// ... snip ... [Route ("{configurationId} / edit", name = "Rule configuration edit")] Public ASICNC work and lieutenant; Actionsclass & gt; Edit (int configured) {return view (...); } // Setup ...}
ActionLink , when used like this:
@ html.ActionLink (name, "edit", "rule configuration", new {configurationId = conf.Id})
/ RuleConfiguration / 1 / edit . However, I just get the
/ rule configuration when using the
as RouteLink then:
@ Html.RouteLink (conf.Name , "RuleConfigurationEdit", new {configurationId = conf.Id})
ActionLink , and it does generate one with the expected action name. One difference is that in this other verb, any path parameter is not.
ActionLink spelling is correct, and matches the URL parameter which expects the function .
Name parameter was added to
ActionLink before working
@ Html.ActionLink (name, "edit "RuleConfiguration", new {configurationId = conf.Id})
public static MvcHtmlString ActionLink (HtmlHelper HtmlHelper, String LinkText, String actionName, Object routeValues, Object htmlAttributes)
& lt; A configuration = "1" href = "" & gt; Will happen & lt; / A & gt;
Configure IID is added to the attribute element because the last parameter is
htmlAttributes parameter.
rule configuration controller , then to do the right thing (by using overload) Em> seems to:
@ Html.ActionLink (name, "edit", new {configurationId = 1})
& lt; A href = "/ Rule Configuration / 1 / Edit" & gt; Fuga & lt; / A & gt;
public Fixed MvcHtmlString ActionLink (this HtmlHelper HtmlHelper, string LinkText, string actionName, string controllerName, object pathValues, object htmlAttributes)
@ Html.ActionLink (name, "edit", "RuleConfiguration", new {configurationId = conf.Id }, Tap)
Comments
Post a Comment