我有30个单独的RadioButton。我无法使用RadioButtonList。有3组按钮。每个组都有一个唯一的GroupName。一切工作正常在网络浏览器。我怎样才能知道在每个给定GroupsNames中选择了哪个按钮?ASP.Net c#给定GroupName中的哪个单选按钮被选中?
编辑:功能我用
private string getRadioValue(ControlCollection clts, string groupName)
{
string ret = "";
foreach (Control ctl in clts)
{
if (ctl.Controls.Count != 0)
{
if (ret == "")
ret = getRadioValue(ctl.Controls, groupName);
}
if (ctl.ToString() == "System.Web.UI.WebControls.RadioButton")
{
RadioButton rb = (RadioButton)ctl;
if (rb.GroupName == groupName && rb.Checked == true)
ret = rb.Attributes["Value"];
}
}
return ret;
}
令人失望,谢谢。 – Justin808 2010-12-07 02:10:35