int an1=0;
int bn1=0;
int d1= 0;
string s1=””;
for (int i = 1; i <= 41; i=i+4)
{
string rblname = “RadioButtonList” + i.ToString();
RadioButtonList rbl =(this.FindControl(rblname) as RadioButtonList);
if (rbl.SelectedValue == “a”) an1=an1+1;
else bn1++;
}
<asp:RadioButtonList ID=”RadioButtonList1″ runat=”server” RepeatDirection=”Horizontal”>
<asp:ListItem Value=”a”> (a) 试试看</asp:ListItem>
<asp:ListItem Value=”b”>(b) 深思熟虑</asp:ListItem>
</asp:RadioButtonList>
rbl总是为null
int bn1=0;
int d1= 0;
string s1=””;
for (int i = 1; i <= 41; i=i+4)
{
string rblname = “RadioButtonList” + i.ToString();
RadioButtonList rbl =(this.FindControl(rblname) as RadioButtonList);
if (rbl.SelectedValue == “a”) an1=an1+1;
else bn1++;
}
<asp:RadioButtonList ID=”RadioButtonList1″ runat=”server” RepeatDirection=”Horizontal”>
<asp:ListItem Value=”a”> (a) 试试看</asp:ListItem>
<asp:ListItem Value=”b”>(b) 深思熟虑</asp:ListItem>
</asp:RadioButtonList>
rbl总是为null
解决方案
20
你贴出的代码根本无法判断该怎么样编程。原因是你没有给出符合 NamingContainer 范围的 aspx 代码设计。