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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:34:27+00:00 2026-05-18T04:34:27+00:00

Reasonably new to MVC. My problem is that I have a controller that has

  • 0

Reasonably new to MVC. My problem is that I have a controller that has 3 different ActionResult’s which are called depending on an enum.
All three action results return the same view but with different lists as the views model. In the view the user should be able to click on an item in the list and view the details based on the ID of the item.
e.g. Site/Facilities/Libraries returns the list of libraries, Site/Facilities/Libraries/1 returns the details. This works fine when you enter the full path but on the View itself clicking the anchor

<a href="@item.ID">@item.Name</a>

on an item in the list returns the Url Site/Facilities/1 instead of Site/Facilities/Libraries/1. I cant use an ActionLink as the Action to call is dynamic. I know this could be solved by creating a different View for each type but I wondered if there might be another way?

Thanks in advance.

  • 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-18T04:34:28+00:00Added an answer on May 18, 2026 at 4:34 am

    You can use such code (a javascript trick):

    <a href="" onclick="window.location = window.location + @item.ID">@item.Name</a>
    

    Or, if you want to use href property, you can use such code:

    <%=Html.ActionLink(item.Name, "Facilities", ViewData("ActionName"), new {id = item.ID}) %>
    

    (In that case you have to specify ViewData(“ActionName”) in controller).

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

Sidebar

Related Questions

I've got a reasonably simple query (this time) that I need ALL the results
I'm currently working on a reasonably simple MVC app which allows the user to
I have a reasonably large project at work that I've inherited. It's an ASP.NET
I am reasonably new to C++ and have limited experience of templates. At the
Which reasonably mature relational or NoSQL databases support filesystem storage that can be moved
For a problem that I'm working on right now, I would like a reasonably
I am reasonably new to Wordpress custom themes but I do have some knowlege
So, I'm reasonably new to both unit testing and mocking in C# and .NET;
Suppose I want to implement a reasonably efficient 'keyword recognition algorithm', that is first
Does anyone know of a reasonably priced tool that will create DDL statements to

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.