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 7767973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:48:17+00:00 2026-06-01T15:48:17+00:00

I have an action like so: @Html.ActionLink(dinner.Title, Details, new { id=dinner.DinnerID }) and a

  • 0

I have an action like so:

@Html.ActionLink(dinner.Title, "Details", new { id=dinner.DinnerID }) 

and a route defined like so:

routes.MapRoute(
                    "PrettyDetails",
                    "{Id}",
                        new { controller = "Dinners", action = "Details" },
                        new { Id = @"\d+" }
                    );

The action link renders <a href="/234">My Dinner</a>

Why does it not display "Details" in the link? Is it because it knows about the routes defined in Global.asax and therefore matches the pattern somehow?

Thanks

  • 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-06-01T15:48:18+00:00Added an answer on June 1, 2026 at 3:48 pm

    Why does it not display “Details” in the link?

    Because the route pattern you have defined in your Global.asax is {Id} where id must be an integer. So to answer your question, yes, the Html.ActionLink helper respects the routes you have defined in your Global.asax.

    If you want to be able to pass a different action than details you will have to modify your pattern. For example like this: {action}/{id}. Obviously the same stands true for the controller part.

    You could use the Html.RouteLink which allows you to specify a route name if you don’t want the evaluation to happen in the order of your route definitions in Global.asax. This way you could target a specific route. Of course the arguments you are passing must be coherent with this route.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an action link that looks like; <%= Html.ActionLink(Model.forumItem.title, ViewForumItem, new { Id
I have a route definition like this: routes.MapRoute( Pagesize, {controller}/{action}/pagesize/{pagesize}, new { controller =
I have a route defined with several hardcoded (non-parameter) segments: routes.MapRoute(null, suggestion/list/by/{tag}, new {
I have a route like routes.MapRoute( Reports, // Route name. reports/{controller}/{action}/{id}/{start}/{end}, // URL with
I have these routes defined: routes.MapRoute(CategoryList_CountryLanguage, Categories/{id}/{urlCategoryName}/{country}/{language}, new { controller = Categories, action =
I have the following routes defined for my application: routes.MapRoute( Referral, // Route name
Global.asax route values routes.MapRoute( Default, // Route name {controller}/{action}/{id}, // URL with parameters new
I have this route routes.MapRoute( ViewGames, // Route name psp/{controller}/{action}, // URL with parameters
I have the following Html: <%: Html.ActionLink(item.ProductName, Details, Product, new { item.ProductId }, null)%>
I have a action link setup like so: @Html.ActionLink(Orders, Index, Order) When I am

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.