Asp.Net MVC 3 Razor Rendering Bug?

This is strange ... I have the following markup for presentation using the Razor ASP.Net MVC 3 RC viewer

            <p>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Client.FirstName)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Client.FirstName) @Html.ValidationMessageFor(model => model.Client.FirstName)
                </div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Client.LastName)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Client.LastName) @Html.ValidationMessageFor(model => model.Client.LastName)
                </div>
            </p>

The problem is that when displaying the P tag does not surround DIVs! He does the following:

<p>
                </p><div class="editor-label">
                    <label for="Client.FirstName">First Name</label>
                </div>
                <div class="editor-field">
                    <input class="text-box single-line" data-val="true" data-val-required="The First Name field is required." id="Client_FirstName" name="Client.FirstName" value="My FName" type="text"> <span class="field-validation-valid" data-valmsg-for="Client.FirstName" data-valmsg-replace="true"></span>
                </div>
                <div class="editor-label">
                    <label for="Client.LastName">Last Name</label>
                </div>
                <div class="editor-field">
                    <input class="text-box single-line" data-val="true" data-val-required="The Last Name field is required." id="Client_LastName" name="Client.LastName" value="My LName" type="text"> <span class="field-validation-valid" data-valmsg-for="Client.LastName" data-valmsg-replace="true"></span>
                </div>

What's happening? Any help is appreciated!

+3
source share
3 answers

A paragraph cannot contain other block level elements. w3c

also check question

+4
source

P . , . DIV

+2
source

Source: https://habr.com/ru/post/1778676/


All Articles