-1

I am trying to render my partial view inside table row (which is inside thead tag) but I`m always have the view rendered outside of the row . Here is the code:

<tr id="lineTimes">
                <th> <partial name="LineTimesRow" model="Model.LineTimes" /></th>                             
</tr>

Quick inspection of DOM shows following: enter image description here

What even more strange is that if I put this partial view inside of tbody tag then it renders just fine:

 <tbody id="lineTimes">              
            <partial name="LineTimesRow" model="Model.LineTimes" />
 </tbody>

enter image description here

I`m trying to investigate this for like 5 hours - without any luck. Can someone point me to the right direction? Any help will be appreciated. Here is the whole code snippet:

<table class="table table-sm table-hover text-center arrow-nav table-line-times">
        <thead class="thead-dark">
            <tr>
                <th>
                    Artikel
                </th>
                <th>
                    &nbsp;
                </th>
                <th>THT</th>
                <th>lotsize</th>
                <th title="Incr lotsize">incr</th>
                @Html.DisplayFor(model => model.ViewHeader, "WeekplanningDateHeader")
            </tr>
            @*<tr id="lineTimes">
                <th> <partial name="LineTimesRow" model="Model.LineTimes" />  </th>                             
            </tr>*@
        </thead>
        <tbody id="lineTimes">              
            <partial name="LineTimesRow" model="Model.LineTimes" />
        </tbody>
        <tbody>
            @Html.EditorFor(model => model.Days)
        </tbody>
        <tfoot></tfoot>
    </table>

EDIT:

Fixed it - the issue was in the partial itself and my lack of understanding on how table nesting works. My partial were combined of table rows (tr) elements. And because I am trying to inject it into another table row (tr element) it is just ignored because tr cannot be inside another tr just "as is" - (nested tr needs to be wrapped in table). Mystery solved!

Community
  • 1
  • 1
Sivich
  • 51
  • 1
  • 5

1 Answers1

0

Fixed it - the issue was in the partial itself and my lack of understanding on how table nesting works. My partial were combined of table rows (tr) elements. And because I am trying to inject it into another table row (tr element) it is just ignored because tr cannot be inside another tr just "as is" - (nested tr needs to be wrapped in table). Mystery solved!

Sivich
  • 51
  • 1
  • 5