开发者

Radio button checked with Html.RadioButtonFor

<%= Html.RadioButtonFor(m => m.AmortizationTermInYears, true, new { pr开发者_StackOverflowopertyName = "AmortizationTermInYears", onchange = "showAmortizationTermInYears();UpdateField(this);", amortizationTermInYearsRadio = "true" })%>

How do I tell this helper to check this radio button. I tried adding true after the true I already specified (which is the value not the isChecked) paramater, but that didn't compile, it said no RadioButtonFor() definition has those 4 parameters specified.


Try this:

 <%= Html.RadioButtonFor(m => m.AmortizationTermInYears, true, 
         new { 
              propertyName = "AmortizationTermInYears", 
              onchange = "showAmortizationTermInYears();UpdateField(this);", 
              amortizationTermInYearsRadio = "true",
              checked="checked"
             }
     )
%>


you can also use

_checked="checked" 

this used to work before. But later on they @class = "checked" has become more of regular use.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜