Hi there
I am quite new with Linq to SQL and MVC but I follow the NerdDinner on ASP.NET site.
I have tables Tournaments and TournamentTypes which TournamentTypeID is a reference.
In my MVC Detail view page, I want to display the TournamentTypeName which is sitting under TournamentTypes object. How do I achieve this?
In model class:
public Tournament GetTournament(int id)
{
return db.Tournaments.SingleOrDefault(x => x.TournamentID == id);
}
In the Detail View:
<p>
TournamentID:
<%= Html.Encode(Model.TournamentID) %>
</p>
<p>
TournamentTypeID:
<%= Html.Encode(Model.TournamentTypeID) %>
</p>
<p>
CourseID:
<%= Html.Encode(Model.CourseID) %>
</p>
<p>
Name:
<%= Html.Encode(Model.Name) %>
</p>