Question: i have:

```
<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>

```

In the button click, I want to get the `RadioButtonList.SelectedValue`. I try:

```
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();
        }
 }

```

But i get an error `Object reference not set to an instance of an object.` What is my mistake?

Answer: 
The [NamingContainer](http://msdn.microsoft.com/en-us/library/system.web.ui.control.namingcontainer.aspx) of your RadioButtonList is the GridViewRow not the GridView, so this works:

```
for (int i = 0; i <= gvQuestion.Rows.Count - 1; i++)
{
   RadioButtonList rdbChoice = (RadioButtonList)gvQuestion.Rows[i].FindControl("rdbChoice");
   string rd = rdbChoice.SelectedValue;
}

```

Keep in mind that [FindControl](http://msdn.microsoft.com/en-us/library/system.web.ui.control.findcontrol.aspx) does not look recursively into child container, it only searches the current NamingContainer for the given ID.
Find the RadioButtonList using this:

```
RadioButtonList rd1 = (RadioButtonList)gvQuestion.Rows[i].Cells[<index>].FindControl("rdbChoice");

```

Replace the index reference with the cell number, and find within the cell directly. Or sometimes this works, but I've not had much luck finding at the row level:

```
RadioButtonList rd1 = (RadioButtonList)gvQuestion.Rows[i].FindControl("rdbChoice");

```