Is it possible to have such a nested UI with JQuery/JTemplates/ASP.NET ?
more or less pseudo-code: The important part is the 2nd foreach loop inside the td.
<table>
<thead style="font-weight: bold">
<tr>
<td>{$P.lang['pupilName']}</td>
<td>{$P.lang['mail']}</td>
</tr>
</thead>
<tbody>
{#foreach $T.table as record}
<tr>
<td>{$T.record.name}</td>
<td>{$T.record.mail}</td>
<td> // thats the 3rd column containing a listbox/list with documents
{#foreach $T.table1 as doc}
<ul>
<li>excel sheet 1</li>
<li>word document 2</li>
<li>pdf document 4</li>
</ul>
{#/for}
</td>
</tr>
{#/for}
</tbody>
</table>
Nested for-each should be possible: see this article that illustrates the example.
Only issue that I see with your code is that I believe that line
{#foreach $T.table1 as doc}
should be something like
{#foreach $T.record.table1 as doc}
i.e. you need to refer to a nested table for each record in parent table.