Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 537499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:56:00+00:00 2026-05-13T09:56:00+00:00

How does HtmlHelper.ActionLink(htmlhelper,string linktext,string action) figures out correct route? If i have this=> HtmlHelper.ActionLink(Edit,Edit)

  • 0

How does HtmlHelper.ActionLink(htmlhelper,string linktext,string action) figures out correct route?

If i have this=>

HtmlHelper.ActionLink("Edit","Edit")

Mvc automatically finds out correct route.

i.e. – if controller was Product, it will render anchor with href product/edit.

So – how to figure out controller name when i got htmlHelper + action name combo?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:56:00+00:00Added an answer on May 13, 2026 at 9:56 am

    If your HtmlHelper looks something like:

    public static string MyHelper(this HtmlHelper htmlHelper,
                                 ... some more parameters ...) {
    
        return ... some stuff ...
    }
    

    Then from your helper, access:

    RouteData routeData = htmlHelper.ViewContext.RouteData;
    string controller = routeData.GetRequiredString("controller");
    

    The RouteData object contains all the values that were processed by ASP.NET Routing for the current request. This will include the parameter names and values from the route, such as “{controller}/{action}/{id}”. Many of the built-in ASP.NET MVC helpers grab “ambient” data from there so that the developer doesn’t have to type them in for every helper they use.

    You can also download the full source code to ASP.NET MVC from here:

    1. ASP.NET MVC 1.0 RTM source code
    2. ASP.NET MVC 2 Release Candidate source code
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use <%= Html.Action(ReadXML) %> and have this error: 'System.Web.Mvc.HtmlHelper' does not contain a
I have the following method: public static string UlList(this HtmlHelper helper, List<IEntity> entities, string
CS1928: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'DropDownList' and the best extension method
I have HtmlHelper in ASP.NET MVC 1. Now I wont to migrate to ASP.NET
i have this code in one of my asp.net mvc views: <%Html.RenderFile(@C:\Members\newsletters\welcome.html);%> I have
I have a HtmlHelper which is used to output some accordion style functionality. This
I am using ASP.NET MVC 2 Preview 2 and have written a custom HtmlHelper
I've decided upon the HtmlHelper rather than a partial view for this functionality. Does
HtmlHelper.GetTagsAndValues(htmlContent); and i get this error: at System.String.Split(String[] separator, Int32 count, StringSplitOptions options) at
I'm using MVC and I've created a HtmlHelper extension function ImageLink. This function uses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.