Radio Button doesn't reflect Model's value

后端 未结 1 1666
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-20 11:10

I have a kendo Grid for a class, and for that class I\'ve built an editor template to produce a radio button for one of the fields.

This radio button doesn\'t reflec

相关标签:
1条回答
  • 2021-01-20 11:41

    bool type will be render in client like this

    true => True
    false => False
    

    Have you try to inspect your element rendered in HTML? You'll see that the bool value transform into capitalize string. To overcome this you should change true and false in radio button with type string too.

    Your view code should be like this

    <label>
       @Html.RadioButtonFor(x => x.BActive, "true", new { @class = "radio-inline" }) Open
    </label>
    <label>
       @Html.RadioButtonFor(x => x.BActive, "false", new { @class = "radio-inline" }) Close
    </label>
    
    0 讨论(0)
提交回复
热议问题