locked
Column Header in same place / font as <h2> RRS feed

  • Question

  • User2074931137 posted

    Question Illustrated (PDF)

    Question: How do I code the view to display “Letterhaad” column header (in small print) so it appears in the same location and large font as the “Details” header?

     

    @model fvm.Areas.Office.Models.DocumentMenu
    
    @{
        ViewBag.Title = "Details";
    }
        <h2>Details</h2>
    
        <div>
            <h4>DocumentMenu</h4>
            <hr />
            <dl class="dl-horizontal">
                <dt>
                    @*@Html.DisplayNameFor(model => model.DocumentMenuCategoryDisplay)*@
                </dt>
                <dd>
                    @Html.DisplayFor(model => model.DocumentMenuCategoryDisplay)
                </dd>
                <dt> </dt>
                <dd>
                    <table class="table">
                        <tr>
                            <th> </th>
                        </tr>
                        @foreach (var item in Model.DocumentIndexes)
                        {
                            <tr>
                                <td>
                                    <a href=@Html.DisplayFor(modelItem => item.Document.DocumentAccess)>@Html.DisplayFor(modelItem => item.Document.DocumentItem)</a>
                                </td>
                                <td>
                                    <a href=@Html.DisplayFor(modelItem => item.Document.DocumentAccessEdit)>@Html.DisplayFor(modelItem => item.Document.DocumentEdit)</a>
                                </td>
                            </tr>
                        }
                    </table>
                </dd>
            </dl>
        </div>
        <p>
            @Html.ActionLink("Edit", "Edit", new { id = Model.DocumentMenuID }) |
            @Html.ActionLink("Back to List", "Index")
        </p>
    

    Monday, June 24, 2019 12:17 PM

Answers

  • User1520731567 posted

    Hi 3v3rhart,

    Question: How do I code the view to display “Letterhaad” column header (in small print) so it appears in the same location and large font as the “Details” header?

    See the MSDN,

    Html.DisplayFor does not support passing HTML attributes, including class/style.

    At it's most basic it merely renders the value, without any HTML, and with editor/display templates, it just renders whatever's in the template.

    So,I suggest you should probably stick with wrapping it in some html tags,if you want to change the font size like <h2>.

    the style of h2:

    For example:

    <dd style="font-size:30px">
         @Html.DisplayFor(model => model.DocumentMenuCategoryDisplay)
    </dd>

    Best Regards.

    Yuki Tao

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 25, 2019 5:38 AM

All replies

  • User2074931137 posted

    .

    Monday, June 24, 2019 12:24 PM
  • User1520731567 posted

    Hi 3v3rhart,

    Question: How do I code the view to display “Letterhaad” column header (in small print) so it appears in the same location and large font as the “Details” header?

    See the MSDN,

    Html.DisplayFor does not support passing HTML attributes, including class/style.

    At it's most basic it merely renders the value, without any HTML, and with editor/display templates, it just renders whatever's in the template.

    So,I suggest you should probably stick with wrapping it in some html tags,if you want to change the font size like <h2>.

    the style of h2:

    For example:

    <dd style="font-size:30px">
         @Html.DisplayFor(model => model.DocumentMenuCategoryDisplay)
    </dd>

    Best Regards.

    Yuki Tao

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 25, 2019 5:38 AM