WELCOME >>
Home services products support
Friday, September 10, 2010 ..:: Blogs » Brian Swanson ::.. Register  Login
Dec 7

Written by: Brian Swanson
12/7/2006 2:33 AM 

So I've been doing some project work for different companies around Memphis, and have been working a lot with ASP.NET lately.  I'm in the process of creating a simple call tracking system for a customer, and I'm using a GridView on one of the pages.

I setup the GridView, created the DataSource, pointed it at a Business Object that I had created, but everytime I got to the page I would get the following error/exception:

-------------------------------------------------------------------------------------------------------

No parameterless constructor defined for this object.

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.MissingMethodException: No parameterless constructor defined for this object.

-------------------------------------------------------------------------------------------------------

I guess this is one of the bad things about not working with anyone else.  No one to look at your code to help you find the bug...I looked for quite a while trying to find the error...

It turns out the problem is that the method I selected from the business object wasn't “Shared”, which means that it was trying to instantiate the object in order to call the method.  Well the only “New” routine I had was to create a fully populated object to be used by the GridView.  So I changed the function to “Shared” and all was well.

Just thought I'd pass along the tidbit in case anyone else runs into a similar issue.

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 





Copyright 2008 by Purple Ant LLC   Terms Of Use  Privacy Statement