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
This should work fine (It will select the radio button) as long as you set the correct value to the PrintType property of your view model which you are passing to your view.
public ActionResult Index()
{
return View( new QuotePiecePrinting { PrintType=2});
}
But if you want that to have the css class active, you can explicitly apply that css class to the parent label of the selected radio button on the document ready event. So add this to your page's script.
$(function(){
$("input[name='PrintType']:checked").closest("label.btn").addClass("active");
});