c# - Redirect to a controller's action from another controller while action name is same in both controllers -
I have two controller controllers 1 and 2 controller.
I am redirecting to an action name of 1 controller controller 1 from Controller Controller 1, whereas the controller controller 2 has an action name in Action1. Therefore, when I
@ html.ActionLink ("Cancel", "Action 1", "Controller 1", new {id = "btnCancel", @class = "btn BTn-LG BTN -Partial BTN-Block flares "}) This redirects the action 1 action of the controller 2.
Ah, you can help me at this
That helps you post the actual code. You are actually using:
public static MvcHtmlString ActionLink (this HtmlHelper html helper, string link text, string action name, object path value, object html accवटates) you want:
public static MvcHtmlString ActionLink (this HtmlHelper html helper, string link text, string action name, string control name, object path value, object htmlAttributes) Basically, add an empty object before your html properties . You will see that there is no surcharge for string, string, string, object . You have to be wary of the @HTML overload, it is very easy to catch the wrong one without the compiler error. Finally, you want:
@HTMLconnect ("Cancel", "Action 1", "Controller 1", blank, new {id = "BTN Kanal", @class = "btn btn-LG btn-primary btn-block flage"})
Comments
Post a Comment