-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!

2
  • You are missing the closing /> Commented Mar 14, 2019 at 18:31
  • Mistyped it here in the question, have everything closed in the code (still having that issue) Commented Mar 15, 2019 at 7:40

1 Answer 1

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.