How can I disable Visual Studio Compile Warning for HTML "Element 'summary' can appear no more than 1 time(s) inside element 'details'"?

Or how can I find the pragma warning number to surround the code in pragma warning disable and pragma warning restore?

            <details id="Hearing_Audition" @Html.TabOpen("Hearing_Audition", (string)ViewBag.Tab)>
                @if (Model.Definition.SchedulingIndicator)
                {
                    <summary>@Resources.TabScheduling</summary>
                }
                else
                {
                    <summary>@Resources.TabHearing</summary>
                }
                @Html.Partial("_EditScheduledHearing")
            </details>
1

There are 1 best solutions below

2
On

Put the if inside the summary:

         <summary>
         @if (Model.Definition.SchedulingIndicator)
            {
                <text>@Resources.TabScheduling</text>
            }
            else
            {
                <text>@Resources.TabHearing</text>
            }
         </summary>