如何设置ASp.net MVC 2 RadioButtonFor()作为默认选中 [英] How to Set RadioButtonFor() in ASp.net MVC 2 as Checked by default

查看:814
本文介绍了如何设置ASp.net MVC 2 RadioButtonFor()作为默认选中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置RadioButtonFor()作为默认选中

How can i Set RadioButtonFor() as Checked By Default

<%=Html.RadioButtonFor(m => m.Gender,"Male")%>

有出路(Html.RadioButton),而不是(Html.RadioButtonFor)

there is way out for (Html.RadioButton) but not for (Html.RadioButtonFor)

什么想法?

推荐答案

<一个href=\"http://stackoverflow.com/questions/2512809/has-anyone-implement-radiobuttonlistfort-for-asp-net-mvc/2590001#2590001\">This在计算器上的问题中涉及RadioButtonListFor,答案也解决你的问题。您可以在RadioButtonListViewModel设置所选属性。

This question on StackOverflow deals with RadioButtonListFor and the answer addresses your question too. You can set the selected property in the RadioButtonListViewModel.

这篇关于如何设置ASp.net MVC 2 RadioButtonFor()作为默认选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆