I have the following HTML markup in my .NET MVC project:
<div class="row">
<div class="span6">@Model.Data</div>
<div class="span6">@Model.OtherData</div>
</div>
I'm getting data from server. So I want to do the following:
If data is empty then show other data with width = 100%.
Just to clarify I want to do something like that:
<div class="row">
<div class="span12">@Model.OtherData</div>
</div>
Or vice versa.
Is there a way to do that? Maybe with using different HTML tags / CSS classes.
Essentially you just want conditionally display the
@Model.Dataonly if it isn'tnull. You can also set the col class with a variable, and conditionally change that variable depending if@Model.Dataexists or not. Try something like this: