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

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top