I feel a little silly asking this question, but for some reason I am inclined to think that life is thinking about how to do what I want.
I have a <div class="row"> in which there is my field label and field.
I want to completely hide this line if the value of my field is returned as empty.
HTML (posted on my CMS):
<div id="rollNumber" class="row"> <label class="col-sm-offset-2 col-sm-3 control-label">[!RollNumberLabel]</label> <div class="col-sm-2 form-control-static">[!RollNumber]</div> </div>
View code:
if (newBankdetails.RollNumber != null && newBankdetails.RollNumber != "") { template.Nvc.Add("[!RollNumberLabel]", "Roll number"); template.Nvc.Add("[!RollNumber]", newBankdetails.RollNumber); }
I tried to do:
template.Nvc.Add("[!RollNumberLabel]", ""); template.Nvc.Add("[!RollNumber]", "");
but this adds a space between the line above and below this line.
I am for any suggestions, whether it be JavaScript, JQuery, CSS or, if possible, using HTML (although I do not think that this can be done so).
I cannot add code to my CMS, so this needs to be done in my code.
My site uses Twitter Bootstrap
source share