﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Issues  » WebForms - BO.Add method causes error with DropDownList</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Sat, 18 Apr 2026 01:02:30 GMT</lastBuildDate><ttl>20</ttl><item><title>WebForms - BO.Add method causes error with DropDownList</title><link>http://forum.strataframe.net/FindPost17666.aspx</link><description>&lt;SPAN&gt;&lt;H1&gt;&lt;FONT face=Arial size=1&gt;Hi,&lt;/FONT&gt;&lt;/H1&gt;&lt;P&gt;I'm using WebForms with DropDownList (actually I have two DropDownLists - one has PopulationType set to Enumerator and second BusinessObject). Everything works fine - navigation througs records, editing, saving, deleting&amp;nbsp;- all works fine. All except adding new row. When I click on the Add button and call BO.Add method, the error below my post occurs. When I remove these two dropdowns and there only remains textboxes, checkboxes etc. - the BO.Add method doesn't produce any error and I can add new records without problems. &lt;/P&gt;&lt;P&gt;Finally - I have found a workaround that I can use in some of forms but not all:&lt;/P&gt;&lt;P&gt;I use one form for searching and navigation through records and one for editing. The editing form doesn't allow any navigation. On Page_Load event of the editing form I check whether I should read record from DB by primary key or add new record - and in this moment I call BO.Add method and it works fine with DropDowns. &lt;/P&gt;&lt;P&gt;However, I need to use searching, navigation and editing in single form. &lt;/P&gt;&lt;P&gt;Any solution, please?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Here is the error message:&lt;/P&gt;&lt;H1&gt;&amp;nbsp;&lt;/H1&gt;&lt;H1&gt;&lt;FONT size=1&gt;[codesnippet]Server Error in '/' Application. &lt;/FONT&gt;&lt;/H1&gt;&lt;H1&gt;&lt;FONT size=1&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/H1&gt;&lt;H1&gt;&lt;FONT size=1&gt;'ddBPaID' has a SelectedValue which is invalid because it does not exist in the list of items.&lt;BR&gt;Parameter name: value &lt;BR&gt;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. &lt;/FONT&gt;&lt;/H1&gt;&lt;H1&gt;&lt;FONT size=1&gt;Exception Details: System.ArgumentOutOfRangeException: 'ddBPaID' has a SelectedValue which is invalid because it does not exist in the list of items.&lt;BR&gt;Parameter name: value&lt;/FONT&gt;&lt;/H1&gt;&lt;H1&gt;&lt;FONT size=1&gt;Source Error: &lt;/FONT&gt;&lt;/H1&gt;&lt;H1&gt;&lt;FONT size=1&gt;An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. &lt;/FONT&gt;&lt;/H1&gt;&lt;H1&gt;&lt;FONT size=1&gt;Stack Trace: &lt;/FONT&gt;&lt;/H1&gt;&lt;H1&gt;&lt;FONT size=1&gt;[ArgumentOutOfRangeException: 'ddBPaID' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value]&amp;nbsp;&amp;nbsp; System.Web.UI.WebControls.ListControl.set_SelectedValue(String value) +1827674[TargetInvocationException: Exception has been thrown by the target of an invocation.]&amp;nbsp;&amp;nbsp; System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct&amp;amp; sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0&amp;nbsp;&amp;nbsp; System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72&amp;nbsp;&amp;nbsp; System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +371&amp;nbsp;&amp;nbsp; System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29&amp;nbsp;&amp;nbsp; System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) +96&amp;nbsp;&amp;nbsp; System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index) +24&amp;nbsp;&amp;nbsp; MicroFour.StrataFrame.Business.TypePropertyCache.SetPropertyValue(Type OwnerType, Object Owner, String PropertyName, Object Value, String FormatString) +260&amp;nbsp;&amp;nbsp; MicroFour.StrataFrame.Business.TypePropertyCache.SetPropertyValue(Object Owner, String PropertyName, Object Value) +82&amp;nbsp;&amp;nbsp; MicroFour.StrataFrame.Business.BusinessLayer.PushDataToWebControl(IWebBusinessBindable ControlToBind, IWebBinding Binding) +273&amp;nbsp;&amp;nbsp; MicroFour.StrataFrame.Business.BusinessLayer.BindDataToWebControl(IWebBusinessBindable ControlToBind, IWebBinding Binding) +1024&amp;nbsp;&amp;nbsp; MicroFour.StrataFrame.Business.BusinessLayer.BindDataToWebControlPrimary(IWebBusinessBindable ControlToBind) +46&amp;nbsp;&amp;nbsp; MicroFour.StrataFrame.UI.Web.BasePage.BindControls() +224[UIException: An error occurred while binding data to the web control 'ddBPaID'.]&amp;nbsp;&amp;nbsp; MicroFour.StrataFrame.UI.Web.BasePage.BindControls() +577&amp;nbsp;&amp;nbsp; MicroFour.StrataFrame.UI.Web.BasePage.Page_PreRender(Object sender, EventArgs e) +30&amp;nbsp;&amp;nbsp; System.Web.UI.Control.OnPreRender(EventArgs e) +2117836&amp;nbsp;&amp;nbsp; System.Web.UI.Control.PreRenderRecursiveInternal() +86&amp;nbsp;&amp;nbsp; System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041&lt;/FONT&gt;&lt;/H1&gt;&lt;H1&gt;&lt;FONT size=1&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/H1&gt;&lt;H1&gt;&lt;BR&gt;&lt;FONT size=1&gt;Version Information: Microsoft .NET Framework Version:2.0.50727.1434; ASP.NET Version:2.0.50727.1434 [/codesnippet]&lt;/FONT&gt;&lt;/H1&gt;&lt;/SPAN&gt;&lt;FONT face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "&gt;&lt;/FONT&gt;&lt;!-- [ArgumentOutOfRangeException]: 'ddBPaID' 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.set_SelectedValue(String value)[TargetInvocationException]: Exception has been thrown by the target of an invocation.   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct&amp; sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)   at MicroFour.StrataFrame.Business.TypePropertyCache.SetPropertyValue(Type OwnerType, Object Owner, String PropertyName, Object Value, String FormatString)   at MicroFour.StrataFrame.Business.TypePropertyCache.SetPropertyValue(Object Owner, String PropertyName, Object Value)   at MicroFour.StrataFrame.Business.BusinessLayer.PushDataToWebControl(IWebBusinessBindable ControlToBind, IWebBinding Binding)   at MicroFour.StrataFrame.Business.BusinessLayer.BindDataToWebControl(IWebBusinessBindable ControlToBind, IWebBinding Binding)   at MicroFour.StrataFrame.Business.BusinessLayer.BindDataToWebControlPrimary(IWebBusinessBindable ControlToBind)   at MicroFour.StrataFrame.UI.Web.BasePage.BindControls()[UIException]: An error occurred while binding data to the web control 'ddBPaID'.   at MicroFour.StrataFrame.UI.Web.BasePage.BindControls()   at MicroFour.StrataFrame.UI.Web.BasePage.Page_PreRender(Object sender, EventArgs e)   at System.Web.UI.Control.OnPreRender(EventArgs e)   at System.Web.UI.Control.PreRenderRecursiveInternal()   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)[HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown.   at System.Web.UI.Page.HandleError(Exception e)   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.ProcessRequest()   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)   at System.Web.UI.Page.ProcessRequest(HttpContext context)   at ASP.m51_fuser_management_aspx.ProcessRequest(HttpContext context)   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)--&gt;</description><pubDate>Thu, 10 Jul 2008 11:06:39 GMT</pubDate><dc:creator>Jiri Brazda</dc:creator></item><item><title>RE: WebForms - BO.Add method causes error with DropDownList</title><link>http://forum.strataframe.net/FindPost17765.aspx</link><description>Glad it got you what you needed...and sorry you had to wait so long for your answer!</description><pubDate>Thu, 10 Jul 2008 11:06:39 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: WebForms - BO.Add method causes error with DropDownList</title><link>http://forum.strataframe.net/FindPost17760.aspx</link><description>Trent, &lt;/P&gt;&lt;P&gt;thank You, this solution is really easy and it works perfectly. &lt;/P&gt;&lt;P&gt;Thank You againg!!!</description><pubDate>Thu, 10 Jul 2008 10:31:39 GMT</pubDate><dc:creator>Jiri Brazda</dc:creator></item><item><title>RE: WebForms - BO.Add method causes error with DropDownList</title><link>http://forum.strataframe.net/FindPost17749.aspx</link><description>&lt;IMG src="http://forum.strataframe.net/Uploads/Images/3e4813be-0349-4368-abbd-fdb5.png"&gt;Jiri,&lt;/P&gt;&lt;P&gt;I missed this post, sorry :blush:&lt;/P&gt;&lt;P&gt;It works just like the WinForms combos.&amp;nbsp; You can just set the TopMostItem property with the description and value.&amp;nbsp; You will see it in the property sheet:</description><pubDate>Thu, 10 Jul 2008 09:43:30 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: WebForms - BO.Add method causes error with DropDownList</title><link>http://forum.strataframe.net/FindPost17726.aspx</link><description>I'm using it the same way as in wonforms - the following properties are set:&lt;/P&gt;&lt;P&gt;- BindingField: BPaID&lt;/P&gt;&lt;P&gt;- BindingObjectName: AppUser&lt;/P&gt;&lt;P&gt;- PopulationDataSourceSettings: B4UWebDB.M51.cBusinessPartner|FillForSelect;|BPaName,|{0}|BPaID&lt;/P&gt;&lt;P&gt;- PopulationType: BusinessObject&lt;/P&gt;&lt;P&gt;All other properties are left default...</description><pubDate>Wed, 09 Jul 2008 01:18:19 GMT</pubDate><dc:creator>Jiri Brazda</dc:creator></item><item><title>RE: WebForms - BO.Add method causes error with DropDownList</title><link>http://forum.strataframe.net/FindPost17709.aspx</link><description>It depends on how you are populating the combo boxes.&amp;nbsp; Are you just creating a DataTable and then attaching that as a data source or what?</description><pubDate>Tue, 08 Jul 2008 09:55:56 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: WebForms - BO.Add method causes error with DropDownList</title><link>http://forum.strataframe.net/FindPost17679.aspx</link><description>Hi Trent, &lt;/P&gt;&lt;P&gt;thank You for Your answer. It sounds like a solution, however I do not know how to make a workaround with "&amp;lt;Select Item&amp;gt;". Would You be so kind and post here a piece of code, please?&lt;/P&gt;&lt;P&gt;The second point is what I would like to ask too - when I would like to have the possibility to&amp;nbsp;NOT select the value from&amp;nbsp;combo: It seems it&amp;nbsp;is not possible to set this property on combo but I have to add a new datarow with NULL or zero value to datatable that&amp;nbsp;is returned by function I use&amp;nbsp;for combo population. And when I would&amp;nbsp;like to have this field empty, the added row will be selected&amp;nbsp;- is it right?&amp;nbsp;Or is there any more sophisticated way?&lt;/P&gt;&lt;P&gt;Thank You</description><pubDate>Mon, 07 Jul 2008 09:52:23 GMT</pubDate><dc:creator>Jiri Brazda</dc:creator></item><item><title>RE: WebForms - BO.Add method causes error with DropDownList</title><link>http://forum.strataframe.net/FindPost17675.aspx</link><description>The problem is that the web combos are somewhat unforgiving if a value doesn't exist within the list that it is expecting.&amp;nbsp; One way to get around this is to add a top most item of the initialized value.&amp;nbsp; For example, when a new record is created it initializes the values (i.e. an integer as a 0, etc.).&amp;nbsp; But there is not a 0 in the list.&amp;nbsp; You can have a rule that ensures that a value is selected.&amp;nbsp; But the way we get around this is to create an item in the combo that has a "&amp;lt;Select Item&amp;gt;" row so that you will never get this error.&amp;nbsp; The selected value would be the initialized value so it would properly "line-up" when bound.</description><pubDate>Mon, 07 Jul 2008 09:33:24 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>