Connecting Tech Pros Worldwide Forums | Help | Site Map

Object reference not set to an instance of an object.

somersbar@yahoo.com
Guest
 
Posts: n/a
#1: Mar 21 '06
i have a dropdownlist and 2 textbox's on my webform.
i have a table 'Areas', with 2 fields in the dataset.

In the Data properties of the DDL i have its DataTextField set to the
field 'areaName', and its DataValueField set to the other field
'areaID'.

When i select an item from the DDL i want the 'areaName' to go into
textBox1 and the 'areaID' to go into textbox2.

when i try get the the selected value:
TextBox1.Text = DropDownList1.SelectedValue
which works, gives me the areaName.

however when i try get the other field, areaID :
TextBox2.Text = DropDownList1.SelectedItem.Text
i get the error :
Object reference not set to an instance of an object.

can anyone tell me what exactly this error means, please?


gella
Guest
 
Posts: n/a
#2: Mar 29 '06

re: Object reference not set to an instance of an object.


may be u hav same areaid for more than one records.
chek select statement.

Closed Thread