I think this might be pretty obvious for others but I cannot understand the working of these type of method overloads. The ones in which we only pass action method name.
How does these @Html.Helpers
get the expected controller?
My guesses:
- That particular Helper extract it from the
HttpContext
this HtmlHelper htmlHelper
parameter holds all the information related to the request.
I am trying to create a custom helper in which user should pass the name of the action method and it magically gets its respective controller.
When I checked the route-values
in this HtmlHelper htmlHelper
during run-time they showed me this-
- {controller, Home}
- {action, Index}
- {id, null}
When I checked the HttpContext
during run-time, it was null
.
Expected output should be-
- {controller, Device}
- {action, Suggest}
- {id, null}
If someone can provide behind the curtains working of default @Html.Helpers
with examples that will be great.
UPDATE I did find what I was looking for. Here is the link to the question and its answer