我是mvc的新手,我想知道如何在mvc中使用单个局部视图用于不同的按钮
<button class="tablinks" onclick="openCity(event, 'Aries')">Aries</button>
<button class="tablinks" onclick="openCity(event, 'Taurus')">Taurus</button>
<button class="tablinks" onclick="openCity(event, 'Gemini')">Gemini</button>
<button class="tablinks" onclick="openCity(event, 'Cancer')">Cancer</button>
<button class="tablinks" onclick="openCity(event, 'Leo')">Leo</button>
<button class="tablinks" onclick="openCity(event, 'Virgo')">Virgo</button>
<button class="tablinks" onclick="openCity(event, 'Libra')">Libra</button>
<button class="tablinks" onclick="openCity(event, 'Scorpio')">Scorpio</button>
<button class="tablinks" onclick="openCity(event, 'Sagittarius')">Sagittarius</button>
<button class="tablinks" onclick="openCity(event, 'Capricorn')">Capricorn</button>
<button class="tablinks" onclick="openCity(event, 'Aquarius')">Aquarius</button>
<button class="tablinks" onclick="openCity(event, 'Pisces')">Pisces</button>
我想要这个按钮的单个部分视图。
答案 0 :(得分:0)
您的部分视图可能只有string
作为其模型:
@model string
<button class="tablinks" onclick="openCity(event, '@Model')">@Model</button>
像这样使用:
@Html.Partial("_YourPartial", "Aries")