RadioButtonList Object reference not set to an instance of an object.

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

I have a RadioButtonList inside the EditItemTemplate of a Datagrid.

On the Edit command of the datagrid I am calling the following
command:

public void dgNodeBranches_Edit(object sender,
DataGridCommandEventArgs e)
{
RadioButtonList rblNodeOptions =
(RadioButtonList)e.Item.FindControl("rblNodeOptions");

DataSet oDS = GetAvailableNodeBranches();

rblNodeOptions.DataSource = oDS; //error is on this line

rblNodeOptions.DataBind();

rblNodeOptions.DataTextField = "NodeText";
rblNodeOptions.DataValueField = "NodeID";
}

I get an error of Object reference not set to an instance of an
object. I have verified that the spelling is correct on the aspx page
and the codebehind.

Could anyone help with figuring this out?

Thanks,

Tim
 
Without seeing more code, I am just random guessing.

You might have already checked this point, but no offense needed.

The e.Item.FindControl( "rblNodeOptions" ) is coming back as null. That to
me, means there is no control with that name in the row. The DataGrid
implements INamingContainer, so the name might be as you'd expect.

"ctl0_rblNodeOptions"

bill
 
Back
Top