Server Error in '/' Application.

'ddlCountry' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: 'ddlCountry' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value

Source Error:


Line 207:        ddlCountry.Items.Clear()
Line 208:        ddlCountry.Items.Add(New ListItem("Please select...", ""))
Line 209:        ddlCountry.DataBind()
Line 210:        ddlCountry.SelectedValue = theCountry
Line 211:

Source File: D:\ehrmannswines.co.uk\TierMaster.master.vb    Line: 209

Stack Trace:


[ArgumentOutOfRangeException: 'ddlCountry' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value]
   System.Web.UI.WebControls.ListControl.PerformDataBinding(IEnumerable dataSource) +2693966
   System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +290
   System.Web.UI.WebControls.ListControl.PerformSelect() +37
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   TierMaster.refreshDropDowns() in D:\ehrmannswines.co.uk\TierMaster.master.vb:209
   TierMaster.Page_Load(Object sender, EventArgs e) in D:\ehrmannswines.co.uk\TierMaster.master.vb:78
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.4063.0