PDA

View Full Version : ASP.NET - Object reference not set to an instance of an object.



abdulmohsen
March 29th, 2008, 03:23 PM
I have a code behind for my default.aspx page.

I am using a databaind control (RadioButtonList) for options a user would choose from.

some where in the code, i have created a protected function in which i try to reference the list item value of my radio control the user has selected.

when the page submits, i get the following error on this line:


System.NullReferenceException: Object reference not set to an instance of an object.

Here's the line that generates that error:


userChoice = Convert.ToSByte(radioListContainer.SelectedItem.Va lue);


I don't know what i am missing or doing wrong?

Any help please?!

Many thanks