I have a grid doing edit in a popup. When the popup shows it binds from my model to the fields and all the fields bind and return their data back to the controller for Add/Update except for the RadioGroup it always returns null. It binds fine, just not returns any value to the Controller.
I tried the below:
@(Html.Kendo().RadioGroupFor(model => model.Sex)
.Name("Sex1")
.HtmlAttributes(new { style = "width:200px;", @class = "RequiredField" })
.Layout(RadioGroupLayout.Horizontal)
.Items(m =>
{
m.Add().Label("Male").Value("Male");
m.Add().Label("Female").Value("Female");
m.Add().Label("N.A.").Value("N.A.");
})
)
I also tried using javascript to force it to update like below.
@(Html.Kendo().RadioGroupFor(model => model.Sex)
.Name("Sex1")
.HtmlAttributes(new { style = "width:200px;", @class = "RequiredField" })
.Layout(RadioGroupLayout.Horizontal)
.Items(m =>
{
m.Add().Label("Male").Value("Male");
m.Add().Label("Female").Value("Female");
m.Add().Label("N.A.").Value("N.A.");
})
.Events(e =>
{
e.Change("Sex_onChange");
})
)
<script type="text/javascript">
function Sex_onChange(e) {</script>
No matter what I tried my model always returns null for the sex when it hits the controller.
Below is the model.
public class ContactViewModel