[RESOLVED]Generate table header for nested model?

how to generate table header for nested model?

In one of my view i need to display Author Detail and all books related to the author.

How to get the table header for Book in same view?

@model Author gives me Author model details as well as i am able to foreach  Like below but wondering how to get table header ?


public class Author
{
   public string Name{get;set;}
   public string DOB {get;set;}
   public string Description {get;set;}

   public List<Books> BookList{get;set;}
}

public class Book
{
   public string BookIdentification {get;set;}
   public string BookName{get;set;}
   public string Year{get;set;}
   public string price{get;set;}
}

abhi0410

@foreach (var item in Model.BookList) { ////// }

@for (int i = 0; i < Model.BookList.Count;i++ )
{
    @Html.DisplayNameFor(Model => Model.BookList[i].Title)   
}

Leave a Reply