Problem in dropdown list
hi everyone
i am a fresher in asp.net 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"
cboCountry.DataBind()
i want to update record.so 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
|