View Single Post
  #1 (permalink)  
Old September 23rd, 2005, 05:53 AM
ankur_bhargava2000 ankur_bhargava2000 is offline
Registered User
Join Date: Sep 2005
Location: jaipur, rajasthan, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem in dropdown list

hi everyone

i am a fresher in and facing A problem in assigning values in dropdown list.
i have a registeration form in which there is a dropdownlist the code i use to fill the list is

Dim DtCntry As DataTable = ds.Tables("Tbl_Country")
cboCountry.DataSource = DtCntry
cboCountry.DataTextField = "Country"
cboCountry.DataValueField = "CountryId"

i want to update i am assigning the feilds of selected record in page_load event
i have assign the value in dropdown as follows
    If Not Dt.Rows(0).Item("Industry_Id") Is DBNull.Value Then
            cboCountry.SelectedValue = Dt.Rows(0).Item("CountryId")
        End If

this work well but after page load and when i click the modify button and
try to read value the error comes
the error is Object reference not set to an instance of an object.

i am reading through this cboIndustry.SelectedValue

ankur bhargava