I am trying to create a nice group of radio buttons with MVC and Bootstrap 3:
After selecting an option:
I store the value in the database but when I present the View again nothing comes selected:
The Model is:
[Table("QuotePiecePrinting")]
public partial class QuotePiecePrinting
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Display(Name = "Tipo de Impressão")]
public int PrintType { get; set; }
}
The View is:
<div class="form-group">
@Html.LabelFor(model => model.PrintType, htmlAttributes: new { @class = "control-label col-xs-12 col-sm-4 col-md-3" })
<div class="col-xs-6 col-sm-3 col-md-7 col-lg-6">
<div class="btn-group btn-group-justified" data-toggle="buttons">
<label class="btn btn-primary">
@Html.RadioButtonFor(model => model.PrintType, "1") Digital
</label>
<label class="btn btn-primary">
@Html.RadioButtonFor(model => model.PrintType, "2") Offset Convencional
</label>
<label class="btn btn-primary">
@Html.RadioButtonFor(model => model.PrintType, "3") Offset UV
</label>
</div>
</div>
</div>
Why is the stored value of the selected option is not reflected when I present the view again?
The value is correctly stored in the database.