Dropdown

  • Thread starter Thread starter David Lozzi
  • Start date Start date
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
 
Back
Top