asp.net mvc radio button state

后端 未结 7 1963
轮回少年
轮回少年 2021-02-07 19:06

I\'m trying out asp.net mvc for a new project, and I ran across something odd. When I use the MVC UI helpers for textboxes, the values get persisted between calls. But, when I

7条回答
  •  没有蜡笔的小新
    2021-02-07 19:31

    If you give the radio buttons the same name as the property on your model, then MVC will automatically set the checked attribute on the appropriate button.

    I think this relies on having a strongly typed Model.

提交回复
热议问题