Vote count:
0
We have a ton of spark views I'm migrating over to Razor and in many places we use the inline spark if syntax as shown below.
<viewdata about="AboutViewModel" />
<div class="button-container" if="about.shouldShowButton">
<button class="about-acknowledge" type="button">Click Me</button>
</div>
I'm looking for a nice compact similar razor syntax. But all I've been able to come up with is this.
@if(ViewData["about.shouldShowButton"].Equals(true)){
<div class="button-container">
<button class="about-acknowledge" type="button">Click Me</button>
</div>
}
While individually that's not terrible, when you have a few of them close together and they are nested in other tags it gets pretty nasty real fast.
asked 1 min ago
Migrating Spark InLine If view syntax to Razor
Aucun commentaire:
Enregistrer un commentaire