سؤال

I have some trouble with razor sections.

@section tools {
<div class="btn-group"">
    <button class="btn dropdown-toggle" data-toggle="dropdown">
        Update every <span id="update_time_label" class="label label-info">10 s.</span>
        <span class="caret"></span>
    </button>
    <ul class="dropdown-menu">
        <li><a href="#" onclick="return SelfAction.setUpdateTime(1)">1 s.</a></li>
        <li><a href="#" onclick="return SelfAction.setUpdateTime(5)">5 s.</a></li>
        <li><a href="#" onclick="return SelfAction.setUpdateTime(10)">10 s.</a></li>
        <li><a href="#" onclick="return SelfAction.setUpdateTime(30)">30 s.</a></li>
        <li><a href="#" onclick="return SelfAction.setUpdateTime(60)">60 s.</a></li>
        <li><a href="#" onclick="return SelfAction.setUpdateTime(120)">120 s.</a></li>
    </ul>
</div>
<button class="btn" onclick="return SelfAction.loadNewItemsNow()">Update now</button>
} <-- Can't detect

As you see in the code, it does not detect the closing bracket. I'm now learning C# and MVC4 and can't find any solution. I don't want to use viewbag for this big HTML block. Maybe there is some specific closing tag for big HTML blocks? Something like @sectionStart and @sectionEnd?

هل كانت مفيدة؟

المحلول

Remove the second " at the end of <div class="btn-group""> and see if that helps. The Razor engine is VERY finicky, and something stupid like that could cause it to continue to look for a string, and since everything else matches up, the closing } would be inside a string.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top