How can I access dynamically properties from a generated LINQ class ?
Cause I would like to be able to customize the displayed table columns where Partner is the LINQ Class generated from a SQL Server Database Table.
<table class="grid">
<thead>
<tr>
<% foreach (Column c in (IEnumerable)ViewData["columns"]) { %>
<th><%= c.Title %></th>
<% } %>
</tr>
</thead>
<tbody>
<% foreach (Partner p in (IEnumerable)ViewData.Model) { %>
<tr>
<% foreach (Column c in (IEnumerable)ViewData["columns"]) { %>
????? <th> <%= p.GetProperty(c.Name) %> </th> ?????
<% } %>
</tr>
<% } %>
</tbody>
</table>
Any idea how the code of the "p.GetProperty(c.Name)" method could look like ?
Forgive me if the Question is very simple but as I'm new to C# and LINQ I really couldnt figure it out.