7
ASP.NET MVC剃刀:HTML中的条件属性
下面的代码似乎并不干净。有任何改进代码的建议吗? <li @if(ViewData["pagename"].ToString()=="Business details"){ <text>class="active" </text> } > <a @if(ViewData["pagename"].ToString()=="Business details"){ <text>style="color: white; background-color: #08C; border: 1px solid #08C;" </text> } href="@Url.Action("BusinessDetails", "Business")">Business Details</a> </li> <li @if (ViewData["pagename"].ToString() == "Booking policies"){ <text>class="active"</text> }> <a @if (ViewData["pagename"].ToString() == "Booking policies") { <text>style="color: white; background-color: #08C; border: 1px solid #08C;" </text> } …