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?<
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:
Category Details
Category Details
Is that what your after?