StrataFrame Forum

Web Binding to RadioButtonList

http://forum.strataframe.net/Topic32517.aspx

By Govinda Berrio - 4/15/2014

Hello, 

I am binding a BO property to a RadioButtonList control. 
The business object is empty during the whole test. 
The simple scenario is this: 
  • one page
  • one BO in the ApplicationBasePage
  • on the page, a SF RadioButtonList
  • and an <asp:Button>


The page will load fine once. And, everything looks as it should, the bound control is disabled. 
When I click the Button to initiate a PostBack, the result is the following error below the code.

Does anyone have any insight into this? Is this normal ASP.NET behavior or is there a workaround that does not involve manual binding to the control (BindingDirection="None")?

Thank You, 
Govinda

<SFWeb:RadioButtonList RepeatDirection="Horizontal" 
            ID="rblSolutionType" runat="server" BusinessObjectName="QuoteProduct" 
            BindingField="solution_type_lpk"
            PopulationType="Manual">
</SFWeb:RadioButtonList>


'rblSolutionType' 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: 'rblSolutionType' has a 
SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value

Source Error: 

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.

Stack Trace: 



[ArgumentOutOfRangeException: 'rblSolutionType' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value]
   System.Web.UI.WebControls.ListControl.set_SelectedValue(String value) +9708448

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
   System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) +97
   System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index) +21
   MicroFour.StrataFrame.Business.BusinessLayer.ClearWebControl(IWebBusinessBindable ControlToBind, IWebBinding Binding) +409
   MicroFour.StrataFrame.Business.BusinessLayer.BindDataToWebControl(IWebBusinessBindable ControlToBind, IWebBinding Binding) +1294
   MicroFour.StrataFrame.Business.BusinessLayer.BindDataToWebControlPrimary(IWebBusinessBindable ControlToBind) +80
   MicroFour.StrataFrame.UI.Web.BasePage.BindControls() +358

[UIException: An error occurred while binding data to the web control 'rblSolutionType'.]
   MicroFour.StrataFrame.UI.Web.BasePage.BindControls() +921
   MicroFour.StrataFrame.UI.Web.BasePage.Page_PreRender(Object sender, EventArgs e) +37
   System.Web.UI.Control.OnPreRender(EventArgs e) +92
   System.Web.UI.Control.PreRenderRecursiveInternal() +83
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974