Answer the question
In order to leave comments, you need to log in
How to display Join request in ASP.NET View?
Controller
var comments =
from n in db.Comments
join f in db.Files
on n.ID
equals f.CommentId
where n.TreatmentID == id
select new { Comment = n, File = f };
ViewBag.Comments = comments.ToList();
@foreach (var comment in ViewBag.Comments)
{
@comment
}
{ Comment = MvcApplication.Models.Comment, File = MvcApplication.Models.File }
Answer the question
In order to leave comments, you need to log in
good afternoon.
try using typed view (@model )
and then it will be
@foreach (var comment in Model)
{
@comment .Author
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question