Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 17, 2009 02:04 PM by satalaj
Member
157 Points
153 Posts
Aug 15, 2008 12:52 PM|LINK
Having trouble deleting a user or I should say passing paramaters to the method if I'm reading this error correctly. This is coming froma gridview which has its data as follows...
and the objectsource =
the exception details error I'm getting is .
Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.
what am I doing wrong,I'm simply configuring the grid to standard asp.net stored procedures with object sources..
thanks for any help.
Participant
852 Points
127 Posts
Aug 16, 2008 11:35 AM|LINK
Make sure that your User class (or whatever the class is called that you are displaying in the GridView) has a default constructor, e.g:
public class User { public User() { //... } //... }
Star
10505 Points
2031 Posts
MVP
Jun 17, 2009 02:04 PM|LINK
You need to pass the parameters to the ObjectDatasource as your stored procedure is accepting parameters. you can pass it programatically using C# or VB http://www.asp.net/learn/data-access/tutorial-06-cs.aspx or follow this http://www.asp.net/learn/data-access/
dolittle
Member
157 Points
153 Posts
No parameterless constructor defined for this object.
Aug 15, 2008 12:52 PM|LINK
Having trouble deleting a user or I should say passing paramaters to the method if I'm reading this error correctly. This is coming froma gridview which has its data as follows...
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="GetUsers" AllowPaging="True" DataKeyNames="UserName,ProviderUserKey">and the objectsource =
<asp:ObjectDataSource ID="GetUsers" runat="server" TypeName="System.Web.Security.Membership" SelectMethod="GetAllUsers" DeleteMethod="DeleteUser" OldValuesParameterFormatString="original_{0}" DataObjectTypeName="System.Web.Security.MembershipUser" UpdateMethod="UpdateUser"> <DeleteParameters> <asp:Parameter Name="username" Type="String"/> <asp:Parameter Name="deleteAllRelatedData" Type="Boolean" /> </DeleteParameters> </asp:ObjectDataSource> <asp:ObjectDataSource ID="DeleteUser" runat="server" TypeName="System.Web.Security.Users" DeleteMethod="DeleteUser"> </asp:ObjectDataSource>the exception details error I'm getting is .
Exception Details: System.MissingMethodException: No parameterless constructor defined for this object.
what am I doing wrong,I'm simply configuring the grid to standard asp.net stored procedures with object sources..
thanks for any help.
mbischoff
Participant
852 Points
127 Posts
Re: No parameterless constructor defined for this object.
Aug 16, 2008 11:35 AM|LINK
Make sure that your User class (or whatever the class is called that you are displaying in the GridView) has a default constructor, e.g:
public class User { public User() { //... } //... }-- Martin
satalaj
Star
10505 Points
2031 Posts
MVP
Re: No parameterless constructor defined for this object.
Jun 17, 2009 02:04 PM|LINK
You need to pass the parameters to the ObjectDatasource as your stored procedure is accepting parameters.
you can pass it programatically using C# or VB http://www.asp.net/learn/data-access/tutorial-06-cs.aspx
or follow this http://www.asp.net/learn/data-access/