views:

45

answers:

1

This has gotten me completely frustrated

I have a few webcombo boxes that are hierachial:

Continent Country

When the form loads everything works fine, when I change the continent the first time, the country repopulates correctly. However if I change the continent a second time I receive an error:

Specified argument was out of the range of valid values.Parameter name: The DataValueField of ValueField was not found in the Columns collection. 

Can anyone tell me why?

P.S. This is all I have in the Page_Load event

            if (!IsPostBack)
        {
            this.Load_AreaList();
            this.Load_AreasOfInterest();
            this.Load_Degrees();
            this.Load_GenderList();
            this.Load_ParticipationDateModifiers();
            this.Load_ProgramCategories(nEventID);
            this.Load_YesNoList();
            this.Load_ParticipantInformation(nParticipantID); 
        }

Also this happens in another part of the form with another Country webcombo which is supposed to populate a state combo box.

A: 

Hi,

In many cases, columns in database tables return null when no value is stored in that column. However, a null value can present challenges when you are working with ASP.NET code or with data-bound Web controls. For example, an exception is thrown if you try to bind the SelectedValue of a DropDownList control to null. If this is not the case change AppendDataBoundItems property. The AppendDataBoundItems property allows you to add items to the ListControl object before data binding occurs. After data binding, the items collection contains both the items from the data source and the previously added items.

Let me know if it works...

Muse VSExtensions
Muse,Thank you for this insight. I should have been more specific as to what type of combo control I was using. But never the less, your information about the null values got me thinking and I realized it was not the combo boxes in questino causing it but another combo that had no data at page load. This is working now thanks to your hints.
mattgcon