Friday, 15 March 2013

c# - MVC 5 - Partial view not showing data -



c# - MVC 5 - Partial view not showing data -

i have company model seen below.

the company model has iqueryable of emailhistory (this model).

public int id { get; set; } public string companyname { get; set; } public iqueryable<iemailhistory> emailhistory { get; set; }

in company controller company details , email history records, controller.

//go repository , company record var companyrecord = therepository.getcompany(transaction.companyid, user.identity.getuserid()); //get emails company companyrecord.emailhistory = therepository.getemailhistorybycompany(user.identity.getuserid(), id);

if expand results @ point in controller can see emails company.... far ok.

my company page has partial view email history.

@ html.partial("~/views/emailhistory/_emailhistories.cshtml", model.emailhistory);

the partial looks this:

@model list<autosend.model.iemailhistory> <table class="table"> <thead> <tr> <th style="width:100px" class="text-left">to</th> <th style="width:60px" class="text-left">sent date</th> <th style="width:60px" class="text-left">outcome</th> <th style="width:60px" class="text-left">delivered date</th> <th style="width:60px" class="text-left">opened date</th> </tr> </thead> <tbody> @foreach (var emailhistory in model) { <tr> <td class="text-left">@html.display(emailhistory.emailaddress)</td> <td class="text-left">@html.display(emailhistory.sentdate.toshortdatestring())</td> <td class="text-left">@html.display(emailhistory.outcome)</td> <td class="text-left">@html.display(emailhistory.emaildelivereddate.toshortdatestring())</td> <td class="text-left">@html.display(emailhistory.emailopened.toshortdatestring()) </td> </tr> } </tbody> </table>

if step through can see loop through email history (and can see values) fine but..... page never renders out info (although associated td's rendered)

i can see table headers , rows no records beingness shown!?

how rendering info in tds without helper method..... @emailhistory.[yourprop]....

c# model-view-controller partial-views

No comments:

Post a Comment