Dropdown list + XML = Object reference not set to an instance of an object.

Discussion in 'ASP .Net' started by darrel, Apr 27, 2004.

  1. darrel

    darrel Guest

    I keep getting a " Object reference not set to an instance of an object. "

    I'm using Dreamweaver and rebuilding a few pages that were produced in
    VS.net. The original page seems to work fine, the new one does not.

    Here's the code in question:

    If IsPostBack Then
    Else
    Dim CountyData As New DataSet()
    Try
    CountyData.ReadXml(MapPath("County.xml"))
    DropDownListCounty.DataSource = CountyData
    DropDownListCounty.DataValueField = "CountyNumber"
    DropDownListCounty.DataTextField = "CountyName"
    DropDownListCounty.DataBind()
    Catch objError As System.Exception
    response.write ("Error Loading County XML - Contact
    Administrator.<br />" _
    & objError.Message & "<br />" & objError.Source)
    Exit Sub
    End Try


    I should know what the "Object reference not set to an instance of an
    object." means, but I'm not sure what, specifically, the reference is. I
    think I need to set "DropDownListCounty" to ian instance of a DropDownList?
     
    darrel, Apr 27, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Parthiv Joshi
    Replies:
    2
    Views:
    694
    Kalyan
    Jul 2, 2004
  2. Suresh Kojhani
    Replies:
    1
    Views:
    2,386
    Anushi
    Jul 29, 2004
  3. Chris Fink
    Replies:
    2
    Views:
    4,093
    David Waz...
    Jul 3, 2003
  4. Replies:
    1
    Views:
    482
    Mark Rae [MVP]
    Sep 20, 2007
  5. Replies:
    1
    Views:
    640
    Peter Kelcey
    Dec 1, 2005
Loading...

Share This Page