Question on html.actionlinklocalized

Feb 8, 2012 at 5:59 PM

Hi there:

First of all, thank you for creating such wonderful application, I am really enjoy to learn mvc from it.

I have a question, i am having trouble to understand how exactly pass parameters from view to controller.

For example, in topic/toolbar.cshtml (view)

<li class="reply">@Html.ActionLinkLocalized("Reply", "Reply", null, new{rel="nofollow"})</li>

I know this goes to the TopicController and the method - "public ActionResult Reply(int id, string name, int? msg)"

I just don't get it that how you pass the id, name, msg from the @html.ActionLinkLocalized??? I looked the HtmlExtensions and put debugger on all the overload methods, i still don't get it.

Would you explain that ? Thanks.

ji

 

 

Coordinator
Feb 9, 2012 at 8:06 AM

Hi ji,

Happy to hear that you are enjoying Nearforums!

About the ActionLinkLocalized extension, it works like the normal actionlink. It uses the current route values to create the virtual path, unless you override them.

If in the current route you have an id/name, and you don't specify otherwise, those values are going to be used to build the url (virtualpath) of the action.

 

Kind Regards,

Jorge