I am using MVC2.
I have 2 controllers called apps and notes. Application is a loan application A note can be added in an application.
On my index I have a grid that displays all the applications, and an action column with links to "add call".
In my application controller, I have action methods for creating and editing. In my note controller, there are action methods for me to create, edit, and delete.
I was wondering if the following is possible when the user clicks on the "Add Note" link, such as to go to URL:
Application / 1 / Note / Note that there is 1 application ID Note note will be the controller, and create the action method in the Note Controller. Is such a thing possible? I have my global Started with mapping in the message, but it is not certain that this is true:
route. MapRoute (null, "application / {applicationID} / {controller} / {action}", new {administrator = "note", action = "create"});
How do I create a link in my grid using the action link?
Please give any advice?
Edit:
The grid given above is in my index view in my home directory. Therefore, on this grid, I have to add the link to display it as above. I am struggling to make this link on my index view. Currently I have this:
Html.ActionLink ("Add Note", "Create", "Note", New {ApplicationID = c.ApplicationID}, Blank) < / P>
and this / note / create /? Required to be displayed as ApplicationID = 1
:
/ application / 1 / note / create
< P> Thanks Brandon
To create a link using this route, ActionLink
Using the Support Method:
& lt;% = html.ActionLink ("create note", "create", "note", new {applicationID = "123"}, tap) % & Gt; / application / 123
and create
action note controller
and pass 123 < / Code> as applicationID
parameter:
public class note controller: controller {create a public workout result (int applicationID) {return view (); It assumes that the routes are registered as follows: Public static zero register routs {routes.IgnoreRoute ("{resource} .axd / {* pathInfo}"); Routes.MapRoute (empty, "application / {applicationID} / {controller} / {action}", new {controller = "note", verb = "create"}); Routes.MapRoute ("default", "{controller} / {action} / {id}", new {controller = "home", action = "index", id = UrlParameter.Optional}); }
Comments
Post a Comment