开发者

Associate a label to MVC RadioButtonFor element

开发者 https://www.devze.com 2023-04-02 04:21 出处:网络
Hi fairly new to using MVC radio buttons开发者_如何学编程. I have some code: @Html.RadioButtonFor(modelItem => item.CheckerApproved, true)

Hi fairly new to using MVC radio buttons开发者_如何学编程. I have some code:

@Html.RadioButtonFor(modelItem => item.CheckerApproved, true)
<label for="?">Accepted</label>
@Html.RadioButtonFor(modelItem => item.CheckerApproved, false)
<label for="?">Rejected</label>

As you can see I'm not sure how to associate the label with the radiobutton.

Can someone please help me with this?


Use the LabelFor helper.

@Html.LabelFor(m => m.CheckerApproved)
0

精彩评论

暂无评论...
验证码 换一张
取 消