[Mono-bugs] [Bug 342536] New: ObjectDataSource can' t find appropriate method in some cases

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Nov 17 15:07:47 EST 2007


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

           Summary: ObjectDataSource can't find appropriate method in some
                    cases
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: x86-64
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.Web
        AssignedTo: mhabersack at novell.com
        ReportedBy: trofimich at gmail.com
         QAContact: mono-bugs at ximian.com
          Found By: ---


Hi. I have such business objects hierarchy:



public class GenericManager<T>
        where T : GenericBusinessClass
{
        public List<T> GetItems(int count)
        {
                List<T> result = new List<T>(count);
                        for (int i = 0; i < count; i++)
                        result.Add((T) Activator.CreateInstance(typeof(T), i +
1));
                        return result;
        }
}

public class Person : GenericBusinessClass
{
        public string Name
        {
                get
                {
                        return "Сруль";
                }
        }

        public Person(int id) : base(id)
        {
        }
}



and use managers for working with them:



public class GenericManager<T>
        where T : GenericBusinessClass
{
        public List<T> GetItems(int count)
        {
                List<T> result = new List<T>(count);

                for (int i = 0; i < count; i++)
                        result.Add((T) Activator.CreateInstance(typeof(T), i +
1));

                return result;
        }
}

public class PersonManager : GenericManager<Person>
{
}



I want to use method PersonManager.GetItems(int count) in ObjectDataSource to
fill DataGridView control:



<asp:ObjectDataSource ID="ObjectDataSource" runat="server"
SelectMethod="GetItems" TypeName="PersonManager">
        <SelectParameters>
                <asp:ControlParameter ControlID="CountHiddenField" Name="count"
PropertyName="Value" Type="Int32" />
        </SelectParameters>
</asp:ObjectDataSource>



But ObjectDataSource can't find GetItems method and i've got an exception:



ObjectDataSource ObjectDataSource could not find a method named 'GetItems' with
parameters count, in type 'MonoASP.PersonManager'.

Description: Error processing request.

Error Message: HTTP 500. System.InvalidOperationException: ObjectDataSource
ObjectDataSource could not find a method named 'GetItems' with parameters
count, in type 'MonoASP.PersonManager'.

Stack Trace:

System.InvalidOperationException: ObjectDataSource ObjectDataSource could not
find a method named 'GetItems' with parameters count, in type
'MonoASP.PersonManager'.
  at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod
(System.Reflection.MethodInfo method, IOrderedDictionary paramValues) [0x00000] 
  at System.Web.UI.WebControls.ObjectDataSourceView.InvokeSelect (System.String
methodName, IOrderedDictionary paramValues) [0x00000] 
  at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect
(System.Web.UI.DataSourceSelectArguments arguments) [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.GridView.DataBind () [0x00000] 
  at System.Web.UI.WebControls.BaseDataBoundControl.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.InternalProcessRequest () [0x00000] 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context)
[0x00000]


-- 
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