我有:无法赶上单选按钮列表里面的SelectedValue电网
<asp:TemplateField HeaderText="Choose Option">
<ItemTemplate>
<asp:RadioButtonList ID="rdbChoice" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Value="A">A</asp:ListItem>
<asp:ListItem Value="B">B</asp:ListItem>
<asp:ListItem Value="C">C</asp:ListItem>
</asp:RadioButtonList>
</ItemTemplate>
</asp:TemplateField>
在按一下按钮,我想要得到的RadioButtonList.SelectedValue
。我尝试:
protected void btnsubmit_Click(object sender, EventArgs e)
{
for (int i = 0; i <= gvQuestion.Rows.Count - 1; i++)
{
RadioButtonList rd1 = (RadioButtonList)gvQuestion.FindControl("rdbChoice");
string rd = rd1.SelectedValue.ToString();
}
}
,但我得到一个错误Object reference not set to an instance of an object.
什么是我的错?
谢谢lot.Its做工perfectly.Waiting一时接受答:) –