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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:54:06+00:00 2026-05-15T09:54:06+00:00

ASP.NET MVC 2 has powerful features for generating the model-dependent content of the Edit

  • 0

ASP.NET MVC 2 has powerful features for generating the model-dependent content of the Edit view (using EditorForModel) and Details view (using DisplayForModel) that automatically utilizes metadata and editor (or display) templates:

<% using (Html.BeginForm()) {%>
    <%= Html.ValidationSummary(true) %>

    <fieldset>
        <legend><%= Html.LabelForModel() %></legend>

        <%= Html.EditorForModel() %>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>

<% } %>

However, I cannot find any comparable tools for the “last” step of generating the Index view (a.k.a. the List view).
There I have to hard code the columns first in the row representing the headers and then inside the foreach loop:

<h2>Index</h2>

<table>
    <tr>
        <th></th>
        <th>
            ID
        </th>
        <th>
            Foo
        </th>
        <th>
            Bar
        </th>
    </tr>

<% foreach (var item in Model) { %>

    <tr>
        <td>
            <%= Html.ActionLink("Edit", "Edit", new { id=item.ID }) %> |
            <%= Html.ActionLink("Details", "Details", new { id=item.ID })%> |
            <%= Html.ActionLink("Delete", "Delete", new { id=item.ID })%>
        </td>
        <td>
            <%= Html.Encode(item.ID) %>
        </td>
        <td>
            <%= Html.Encode(item.Foo) %>
        </td>
        <td>
            <%= Html.Encode(String.Format("{0:g}", item.Bar)) %>
        </td>
    </tr>

<% } %>

</table>

What would be the best way to generate the columns (utlizing metadata such as HiddenInput), with the aim of making the Index view as free of model particulars as Edit and Details?

  • 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-15T09:54:06+00:00Added an answer on May 15, 2026 at 9:54 am

    i think that Phil Haack is doing pretty much what you’re looking for…

    ASP.NET MVC2 templates feature is a pretty nice way to quickly scaffold objects at runtime. Be sure to read Brad Wilson’s fantastic series on this topic starting at ASP.NET MVC 2 Templates, Part 1: Introduction.

    As great as this feature is, there is one template that’s conspicuously missing. ASP.NET MVC does not include a template for displaying a list of objects in a tabular format.

    Check the link for more…

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

Sidebar

Related Questions

I'm using ASP.NET MVC and have a model which has an image (byte array)
I am building a web application using ASP.NET MVC that has two very distinct
I am using asp.net mvc 1.0. I know asp.net mvc has a couple attribute
I am using ASP.Net MVC which has created an id for a textbox for
My asp.net-mvc view has an included javascript file. This javascript file has the following
I've got a really simple ASP.NET MVC View which has a simple string as
For my ASP.NET MVC 3 app (using Razor) my web.config has this: <profile> <providers>
As ASP.NET MVC has a pluggable view engine architecture, and XAML is an object
Say you create a form using ASP.NET MVC that has a dynamic number of
Once an asp.net MVC project has a web deployment project associated with it, there

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.