具有与下面类似的页面设置,HasAnimal始终绑定为false-尽管被选中-任何想法?
cs
public class MyViewModel
{
public bool HasAnimal { get; set; }
public async Task<IActionResult> OnPostAsync() {}
}
cshtml
<label>Yes</label>
<input asp-for="HasAnimal" type="radio" value="true" checked />
<label>No</label>
<input asp-for="HasAnimal" type="radio" value="false" />