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

  • SEARCH
  • Home
  • 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 3493802
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:55:41+00:00 2026-05-18T11:55:41+00:00

I have a table called Categories. I want the user to click from a

  • 0

I have a table called Categories. I want the user to click from a list of Categories and then load a listing of all Auctions in that category.

Simple enough, right?

I could create an action for every category, something like:

public ActionResult Cellphones()
public ActionResult Electronics
public ActionResult Clothes
public ActionResult Cars
public ActionResult RealEstate

This would generate URLs like: /Auctions/Clothes, and /Auctions/RealEstate. Exactly what I’m looking for.

The problem is this requires manual tinkering. When I add a category, I’ll have to manually create a new action and then a new view for it.

Is there a better way to do this?

  • 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-18T11:55:41+00:00Added an answer on May 18, 2026 at 11:55 am

    Create one ActionResult:

    public class AuctionController : Controller
    {
        public ActionResult AuctionCategoryDetails(string categoryName)
        {
            var model = repository.GetAuctionsForCategory(categoryName);
            return View(model);
        }
    }
    

    Then create one route:

    routes.MapRoute(
        "AuctionCategoryDetails",
        "Auctions/{categoryName}",
        new { controller = "Auction", action = "AuctionCategoryDetails" });
    

    So when your displaying a list of categories (not individual details);

    <% foreach (var category in Model.Categories) { %>
       <%: Html.RouteLink("Category Details", "AuctionCategoryDetails", new { categoryName = category.CategoryName });
    <% } %>
    

    That will produce a list of links like this:

    <a href="/Auctions/Clothes">Category Details</a>
    <a href="/Auctions/RealEstate">Category Details</a>
    

    Is that what your after?

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

Sidebar

Related Questions

I have a MYSQL table called 'categories' from a project I inherited from someone
I have a table called categories that has 3 columns: id, name, parent_id .
I have a table called categories. The table holds categories and their sub(subsub)categories... Its
I have two models: store and category with a joining table called categories.stores .
I have a table called Landmarks and a table called Categories with a HABTM
I have a categories table that looks like this: id | name | parent
I have a table called Categories with this structure: CREATE TABLE `Categories` ( `CatID`
I have a products table with a column that contains a space separated list
I have a table vm_category in which I fetch all rows from the category_id
I have a table called users and each user can belong to one group,

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.