Dropdown

D

David Lozzi

Howdy,

I'm getting an error and I'm not sure why:

System.ArgumentOutOfRangeException: 'ddManufacturer' has a SelectedValue
which is invalid because it does not exist in the list of items. Parameter
name: value at
System.Web.UI.WebControls.ListControl.PerformDataBinding(IEnumerable
dataSource) at System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs
e) at System.Web.UI.WebControls.ListControl.PerformSelect() at
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at

This is occuring in the Page_PreRender event of a custom user control. The
actual value isn't set to the drop down until the Page_Load Event so why the
error?

I received the same error with another dropdown list on another page but was
not being fired on either Page event. To correct it, I put the
ddItems.SelectedValue = "test" BEFORE the line to load the dropdown and that
resolved it. Why? Am I missing something?

Thanks a ton

Merry Christmas
David Lozzi
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top