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

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
 
W

William F. Robertson, Jr.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top