views:

35

answers:

1

I would like to display students and their grades with a GridView and LinqToSQL like this:

                       assignment1                     assignment2                
Student 1              55                              89
Student 2              87                              56
Student 3              92                              34

I found this topic but it doesn't answer my question: http://forums.asp.net/t/1557987.aspx

I have a many-to-many relationship between students and assignments called "grades". The grade for the assignment is stored in that table in a "gradeNumber" column.

I would also like to specify which assignments should be displayed in the grid. Btw, my LINQ entities are extended to allow me to write/get studentx.Assignments or assignmentx.Students.

A: 

No one, really? This seems like a pretty common problem you might encounter?

I already tried

            <asp:TemplateField HeaderText="Assignment1">
                <ItemTemplate>
                    <%# Eval("grade[0].something") %>
                </ItemTemplate>
            </asp:TemplateField>

It doesn't work: ...student does not contain a property with the name grade.

It does work when I use class.name however to get a student's class he is in. In code student s.grade[0].something works however.

Remember I have a many-to-many relationship between students and assignments called "grades". How should I fix this?

kversch