473,385 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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("rblNodeOption s");

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
Nov 17 '05 #1
1 2822
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

"Tim" <ti********@hotmail.com> wrote in message
news:30**************************@posting.google.c om...
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("rblNodeOption s");

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

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tapi | last post by:
Hello there, I am new to ASP .NET and am tryimg to create a RadioButtonList dynamically. My code below gives an "Index was out of range" error. Where am I going wrong?
0
by: ani | last post by:
Hi, I have a datalist control and within the Itemplate I have a radiobuttonlist control . I am binding data to the datalist control in Page_load . Also I have sqldatareader object that needs...
1
by: Michael | last post by:
Hi, This should be fairly simple, but it is driving me nuts. First off I have a table in SQL Server, with a column of type "bit". This is meant to store a answer to a Yes/No question. I'm...
4
by: Emil | last post by:
Can somebody tell me what would be the syntax for having an if statement and setting the selected index of a radiobuttonlist? This is my first project using ASP.net and I use C#. I have a repeater...
5
by: velu | last post by:
Problem in getting value from textbox & radiobuttonlist to a valuable inside a datagid. I want to insert a record into a table thru datagrid. Here is the code (see below) Private Sub...
5
by: Øyvind Isaksen | last post by:
I'm making a page to update articles. When a radiobuttonlist is displayed, I want the stored value to be displayed as default (checked). Example: I use a procedure to display the...
0
by: Sudheer Aalla | last post by:
Hi, When I try to reference the radiobuttonlist control in edititemtemplate in ItemDataBound event of datalist control I am getting NULL reference. I am trying to pre select the yes/no button...
4
by: sck10 | last post by:
Hello, I am converting some code from VB to C# and ran into a conversion error: Cannot implicitly convert type 'object' to 'System.Web.UI.WebControls.RadioButtonList'. An explicit conversion...
13
by: tommymo | last post by:
Hi everyone I'm new to this site and the world of ASP.Net C# programming. I have been learning controls and integrating them with a SQL database. So far I have been able to move along and understand...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.