[Mono-bugs] [Bug 360434] New: FormView custom event handler doesn't fire / Problem filling bound DropDownList in code

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Feb 10 14:29:37 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=360434


           Summary: FormView custom event handler doesn't fire / Problem
                    filling bound DropDownList in code
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: x86-64
        OS/Version: openSUSE 10.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Web
        AssignedTo: mhabersack at novell.com
        ReportedBy: psoldack at wp.pl
         QAContact: mono-bugs at lists.ximian.com
          Found By: DeveloperNet


Created an attachment (id=194067)
 --> (https://bugzilla.novell.com/attachment.cgi?id=194067)
Application files

Description of Problem:
I want to fill in items in DropDownList with data generated in code. (For
example: database stored birthdate year and I want to generate all possible
birthdates from 1900 till 2008). DropDownList is data-bound. Filling it in
Page_Load is to late (binding fails because DropDownList is empty). Filling it
in Page_Init is too early (controls are not created yet). Solution (working in
MS.NET) is to add custom event handler to fire when FormView is created. It
works in MS.NET but fails in Mono.

Steps to reproduce the problem:
1. Unzip attached files to a folder.
2. Modify connection strings (in .aspx files) to refer any valid database.
3. Modify Web.Config if needed (contains reference to MySql assembly).
4. Start xsp2 in that folder.
5. Browse to Static.aspx. It shows DropDownList with positions 'A','B','C'. 'B'
should be selected as it was read from database. DropDownList positions are
statically listed in .aspx.
6. Browse to Dynamic.aspx. In MS.NET it does the same as Static.aspx, but
DropDownList positions are generated in code. In Mono it fails with:

Server Error in '/' Application
'DropDownList1' has a SelectedValue which is invalid because it does not exist
in the list of items. Parameter name: value

Description: Error processing request.

Error Message: HTTP 500. System.ArgumentOutOfRangeException: 'DropDownList1'
has a SelectedValue which is invalid because it does not exist in the list of
items. Parameter name: value

Stack Trace:

System.ArgumentOutOfRangeException: 'DropDownList1' 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) [0x00000] 
  at System.Web.UI.WebControls.ListControl.OnDataBinding (System.EventArgs e)
[0x00000] 
  at System.Web.UI.WebControls.ListControl.PerformSelect () [0x00000] 
  at System.Web.UI.WebControls.BaseDataBoundControl.DataBind () [0x00000] 
  at System.Web.UI.Control.DataBindChildren () [0x00000] 
  at System.Web.UI.Control.DataBind (Boolean raiseOnDataBinding) [0x00000] 
  at System.Web.UI.Control.DataBind () [0x00000] 
  at System.Web.UI.Control.DataBindChildren () [0x00000] 
  at System.Web.UI.Control.DataBind (Boolean raiseOnDataBinding) [0x00000] 
  at System.Web.UI.Control.DataBind () [0x00000] 
  at System.Web.UI.Control.DataBindChildren () [0x00000] 
  at System.Web.UI.Control.DataBind (Boolean raiseOnDataBinding) [0x00000] 
  at System.Web.UI.Control.DataBind () [0x00000] 
  at System.Web.UI.Control.DataBindChildren () [0x00000] 
  at System.Web.UI.Control.DataBind (Boolean raiseOnDataBinding) [0x00000] 
  at System.Web.UI.WebControls.FormView.CreateChildControls (IEnumerable data,
Boolean dataBinding) [0x00000] 
  at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding
(IEnumerable data) [0x00000] 
  at System.Web.UI.WebControls.FormView.PerformDataBinding (IEnumerable data)
[0x00000] 
  at System.Web.UI.WebControls.DataBoundControl.OnSelect (IEnumerable data)
[0x00000] 
  at System.Web.UI.DataSourceView.Select
(System.Web.UI.DataSourceSelectArguments selectArgs,
System.Web.UI.DataSourceViewSelectCallback callBack) [0x00000] 
  at System.Web.UI.WebControls.DataBoundControl.PerformSelect () [0x00000] 
  at System.Web.UI.WebControls.BaseDataBoundControl.DataBind () [0x00000] 
  at System.Web.UI.WebControls.FormView.DataBind () [0x00000] 
  at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound ()
[0x00000] 
  at System.Web.UI.WebControls.FormView.EnsureDataBound () [0x00000] 
  at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls ()
[0x00000] 
  at System.Web.UI.Control.EnsureChildControls () [0x00000] 
  at System.Web.UI.Control.PreRenderRecursiveInternal () [0x00000] 
  at System.Web.UI.Control.PreRenderRecursiveInternal () [0x00000] 
  at System.Web.UI.Control.PreRenderRecursiveInternal () [0x00000] 
  at System.Web.UI.Page.ProcessLoadComplete () [0x00000] 
  at System.Web.UI.Page.InternalProcessRequest () [0x00000] 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context)
[0x00000] 


How often does this happen? 
Always (at lease since version 1.2.5.1)


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list