Unbound RadioButtonList Selected Item Problem
-
i m using Visual studio 2005 with c#.here i am having a problem that i have a RadioButtonList which retrives data from sql datasource. it displays the Items correctly.Now when i try to display the SelectedItems on a label i get an error.kindly help me m stuck..m a student a really new to it.please help..thanx a lot... DETAILS OF PROBLEM IS AS FOLLOWS: the error i am getting on browser page is :- "Server Error in '/Website_dtc' Application. -------------------------------------------------------------------------------- Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. " the RadiobuttonList is databound as follows- "RadioButtonList1.DataSource = ds.Tables["temp1"]; RadioButtonList1.DataTextField = "buses"; RadioButtonList1.DataValueField = "buses"; RadioButtonList1.DataBind(); " the RadiobuttonList Item is selected as:- " protected void Button1_Click(object sender, EventArgs e) { lbltemp.Text = RadioButtonList1.SelectedItem.Text; } " Winning isn't everything,its the ONLY thing.