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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:38:02+00:00 2026-05-28T03:38:02+00:00

I have the following class: namespace Storage.Models { public class AdminDetail { public string

  • 0

I have the following class:

namespace Storage.Models
{
    public class AdminDetail
    {
        public string PartitionKey { get; set; }
        public string RowKey { get; set; }
        public string Title { get; set; }
        public string Status { get; set; }
        public string Type { get; set; }
        public string Level { get; set; }
        [DisplayName("Display Order")]
        public string Order { get; set; }
        public int Row { get; set; }
    }

I had some advice and I set up the following as the model in my view:

@model IEnumerable<AdminDetail>

Is it possible for me to somehow reference attributes of my AdminDetail class such as [DisplayName(“Display Order”)]. What I would like to do is something like this to show column labels for the first row of my table grid.

<div>@Html.LabelFor(model => Model.Order)</div>

But I am not sure how to do this as my model is of a collection and not a single instance.

Here’s the code I use to generate data for the view:

        IEnumerable<AdminDetail> details = null;
        IList<AdminDetail> detailsList = null;
        details = from t in _table
                      select new AdminDetail
                      {
                          PartitionKey = t.PartitionKey,
                          RowKey = t.RowKey,
                          Title = t.Title,
                          Status = t.Status,
                          Type = t.Type,
                          Level = t.Level,
                          Order = t.Order
                      };
            #endregion
            detailsList = details
                .OrderBy(item => item.Order)
                .ThenBy(item => item.Title)
                .Select((t, index) => new AdminDetail() { 
                    PartitionKey = t.PartitionKey, 
                    RowKey = t.RowKey, 
                    Title = t.Title, 
                    Status = t.Status, 
                    Type = t.Type, 
                    Level = t.Level, 
                    Order = t.Order, 
                    Row = index + 1 })
                 .ToList();

 return detailsList;
  • 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-28T03:38:03+00:00Added an answer on May 28, 2026 at 3:38 am
    @model IEnumerable<AdminDetail>
    
    @foreach (var detail in Model)
    {
        <div>@Html.LabelFor(x => detail.Order)</div>
    }
    

    or if you are using an editor template which is what I would recommend:

    @model IEnumerable<AdminDetail>
    @Html.EditorForModel()
    

    and then inside the display template (~/Views/Shared/EditorTemplates/AdminDetail.cshtml):

    @model AdminDetail
    <div>@Html.LabelFor(model => model.Order)</div>
    

    UPDATE:

    You could use IList<AdminDetail> as your view model type which will give you index access to elements and you could fetch the metadata like this:

    @model IList<AdminDetail>
    
    <table>
        <thead>
            <tr>
                <th>@Html.LabelFor(x => x[0].Order)</th>
            </tr>
        </thead>
        <tbody>
            @Html.DisplayForModel()
        </tbody>
    </table>
    

    and inside the display template (~/Views/Shared/DisplayTemplates/AdminDetail.cshtml):

    @model AdminDetail
    <tr>
        <td>@Html.DisplayFor(x => x.Order)</td>
    </tr>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following types and classes: namespace MVC.Models public class Page { public
I have the following classes: public class Person { public String FirstName { set;
I have following example method: namespace Postcode_webservice { public class Business { public string
I have the following class: namespace Controls { public class DropDownButton : Control {
I have a C# library with the following Namespace/Class: namespace Helper { public static
I have the following object: namespace LearnLINQ1 { [Table(Name=testMe)] public class SubmitTest { [Column(Name=FirstName)]
Lets say I have the following class: namespace myNamespace { [TypeLibType((short)2)] [ClassInterface((short)0)] [ComImport] public
I have the following class #ifndef Container_H #define Container_H #include <iostream> using namespace std;
Hello I have the following code namespace ConsoleApplication2 { class Program { static void
I have the following mapping for my table in MySql: <class name=Tag, namespace table=tags

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.