Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Object JavaScript MVC Checkbox Font Awesome
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<fieldset class="form-horizontal">
<legend>Contact Information</legend>
<div class="form-group">
@{
var OkToEmailChecked = Model.TheContact.OKToEmail == true ? "checked" : "";
var ContactOnceChecked = Model.TheContact.OKToEmail != true ? "checked" : "";
}
@Html.HiddenFor(model => model.TheContact.OKToEmail)
@Html.LabelFor(model => model.TheContact.OKToEmail,
new { @class = "col-sm-2 control-label" })
<div id="OkToEmailButtonGroup" class="row">
<div class="col-sm-2">
<label for="okToEmail">
<input type="radio" name="OkToEmail" id="okToEmail" value="0"
@OkToEmailChecked />
<span>Send Newsletters</span>
</label>
</div>
<div class="col-sm-2">
<label for="contactOnce">
<input type="radio" name="OkToEmail" id="contactOnce" value="1"
@ContactOnceChecked />
<span>Contact Once</span>
</label>
</div>
</div>
</div>
</fieldset>
<fieldset class="form-horizontal">
<legend>Classtimes</legend>
<div class="btn-group" data-toggle="buttons">
<label class="checkbox btn btn-default">
<input type="checkbox" name="Weekdays" value="Weekdays"
@(Model.Weekdays ? "checked" : "") /><span>Weekdays</span>
</label>
<label class="checkbox btn btn-default">
<input type="checkbox" name="Evenings" value="Evenings"
@(Model.Evenings ? "checked" : "") /><span>Evenings</span>
</label>
<label class="checkbox btn btn-default">
<input type="checkbox" name="Weekends" value="Weekends"
@(Model.Weekends ? "checked" : "") /><span>Weekends</span>
</label>
<label class="checkbox btn btn-default">
<input type="checkbox" name="Online" value="Online"
@(Model.Online ? "checked" : "") /><span>Online</span>
</label>
</div>
</fieldset> <fieldset class="form-horizontal" style="padding-top: 1em">
<div class="form-actions no-color" style="text-align:center">
<input type="submit" value="Send" class="button large dark" />
</div>
</fieldset>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment