Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 23rd, 2005, 05:53 AM
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 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"

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
Old September 27th, 2005, 09:29 AM
Authorized User
Join Date: Sep 2005
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts


somewhere some object has not been instantiated after clicking the button. Best to post your button and pageload code for me to assist you. May be db connection is closed.

Similar Threads
Thread Thread Starter Forum Replies Last Post
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
problem with dropdown list in datagrid marty_nguyen Classic ASP Databases 1 May 22nd, 2005 06:16 PM
The problem with pop-up menu and dropdown list williamwang ASP.NET 1.0 and 1.1 Basics 1 April 14th, 2004 02:33 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.