c# - @Html.DisplayFor does not show property of strongly typed ListObject which is a property of model -


i having model classa below :

public class classa{ public list<classb> bs {get;set}  } 

while classb:

public class classb { public datetime? date{get;set;}  } 

i trying iterate on class in following manner in view

@model classa ...  @foreach(var b in @model.bs) { var _index = 0;  @html.displayfor(x => x.bs.elementat(_index).date) _index++; } 

but getting blank text in view though there data. want print data after iterating on list.since,displayfor default takes model can't use bs in displayfor helper directly.

please provide sample code how achieve desired result.

 var _index = 0;     @foreach(var b in @model.bs)     {           @html.displayfor(x => @model.bs.elementat(_index).date)          _index++;     } 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -