Re: No parameterless constructor error for dataview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hans Kesting

    Re: No parameterless constructor error for dataview

    on 23-9-2008, Julia B supposed :
    Apologies for the cross posting. I posted to the datagrid group a couple of
    weeks ago, but haven't got an answer so am trying here.
    >
    >
    I'm trying to load some data into a dataview, with a datasource that is an
    ObjectDataSourc e object and getting the message "No parameterless constructor
    defined for this object". Basically the webform is in tier 1, which calls a
    function called DisplayUsers in tier 2 (within the Users class), which in
    turn calls a couple of functions/subs in tier 3. This is how it's set up.
    >
    Usually that errormessage means that you derived a class from a
    baseclass that has no parameterless constructors.
    Always when you call a constructor, a constructor of a baseclass is
    also executed (before your own construcor executes). If you don't call
    one explicitly, the parameterless constructor is called automatically.

    I don't know what the VB syntax is. In C# it would be something like:

    class MyClass: MyBaseClass
    {
    // MyBaseClass is a baseclass for this class and
    // has a constructor with one 'int' parameter

    // constructor that explicitly calls a constructor of the baseclass
    public MyClass(int aValue): base(aValue)
    {
    // further processing as needed
    }
    }


    Hans Kesting


  • =?Utf-8?B?SnVsaWEgQg==?=

    #2
    Re: No parameterless constructor error for dataview

    I don't think it's that. My class is not derived from a base class. Any other
    ideas?

    Thanks
    Julia

    "Hans Kesting" wrote:
    on 23-9-2008, Julia B supposed :
    Apologies for the cross posting. I posted to the datagrid group a couple of
    weeks ago, but haven't got an answer so am trying here.
    >

    I'm trying to load some data into a dataview, with a datasource that is an
    ObjectDataSourc e object and getting the message "No parameterless constructor
    defined for this object". Basically the webform is in tier 1, which calls a
    function called DisplayUsers in tier 2 (within the Users class), which in
    turn calls a couple of functions/subs in tier 3. This is how it's set up.
    >
    Usually that errormessage means that you derived a class from a
    baseclass that has no parameterless constructors.
    Always when you call a constructor, a constructor of a baseclass is
    also executed (before your own construcor executes). If you don't call
    one explicitly, the parameterless constructor is called automatically.
    >
    I don't know what the VB syntax is. In C# it would be something like:
    >
    class MyClass: MyBaseClass
    {
    // MyBaseClass is a baseclass for this class and
    // has a constructor with one 'int' parameter
    >
    // constructor that explicitly calls a constructor of the baseclass
    public MyClass(int aValue): base(aValue)
    {
    // further processing as needed
    }
    }
    >
    >
    Hans Kesting
    >
    >
    >

    Comment

    • Hans Kesting

      #3
      Re: No parameterless constructor error for dataview

      Julia B was thinking very hard :
      I don't think it's that. My class is not derived from a base class. Any other
      ideas?
      >
      Thanks
      Julia
      >
      No specific ones, just general questions:
      * When and where do you get that error exactly?
      * Compile time/runtime?
      * Source line
      * Is there a stacktrace that can help you pinpoint the error?
      * Can you shorten that example so that we don't have to wade through
      all sorts of properties that are probably not involved in the problem?
      If the system complains about a constructor, then SQL code is probably
      not the problem.
      See also http://www.yoda.arachsys.com/csharp/complete.html

      Hans Kesting


      "Hans Kesting" wrote:
      >
      >on 23-9-2008, Julia B supposed :
      >>Apologies for the cross posting. I posted to the datagrid group a couple of
      >>weeks ago, but haven't got an answer so am trying here.
      >>>
      >>
      >>>
      >>I'm trying to load some data into a dataview, with a datasource that is an
      >>ObjectDataSou rce object and getting the message "No parameterless
      >>constructor defined for this object". Basically the webform is in tier 1,
      >>which calls a function called DisplayUsers in tier 2 (within the Users
      >>class), which in turn calls a couple of functions/subs in tier 3. This is
      >>how it's set up.
      >>>
      >>
      >Usually that errormessage means that you derived a class from a
      >baseclass that has no parameterless constructors.
      >Always when you call a constructor, a constructor of a baseclass is
      >also executed (before your own construcor executes). If you don't call
      >one explicitly, the parameterless constructor is called automatically.
      >>
      >I don't know what the VB syntax is. In C# it would be something like:
      >>
      >class MyClass: MyBaseClass
      >{
      > // MyBaseClass is a baseclass for this class and
      > // has a constructor with one 'int' parameter
      >>
      > // constructor that explicitly calls a constructor of the baseclass
      > public MyClass(int aValue): base(aValue)
      > {
      > // further processing as needed
      > }
      >}
      >>
      >>
      >Hans Kesting
      >>
      >>
      >>

      Comment

      Working...