473,732 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FormView and ObjectDataSourc e - Delete doesn't work

I am using a formview with an ObjectDatasourc e in ASP .Net 2.0. Everything
works fine until I try the delete. The ItemDeleting event fires, so I know
it should fire my delete method, but instead I get an error: No parameterless
constructor defined for this object, and the delete method is never called.

Anyone have any ideas?
Nov 19 '05 #1
4 14319
I thought the stack trace may help on this

[MissingMethodEx ception: No parameterless constructor defined for this
object.]
System.RuntimeT ypeHandle.Creat eInstance(Runti meType type, Boolean
publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHa ndle& ctor,
Boolean& bNeedSecurityCh eck) +0
System.RuntimeT ype.CreateInsta nceSlow(Boolean publicOnly, Boolean
fillCache) +103
System.RuntimeT ype.CreateInsta nceImpl(Boolean publicOnly, Boolean
skipVisibilityC hecks, Boolean fillCache) +261
System.Activato r.CreateInstanc e(Type type, Boolean nonPublic) +66

System.Web.UI.W ebControls.Obje ctDataSourceVie w.InvokeMethod( ObjectDataSourc eMethod method, Boolean disposeInstance , Object& instance) +127

System.Web.UI.W ebControls.Obje ctDataSourceVie w.InvokeMethod( ObjectDataSourc eMethod method) +38
System.Web.UI.W ebControls.Obje ctDataSourceVie w.ExecuteDelete (IDictionary
keys, IDictionary oldValues) +1110
System.Web.UI.D ataSourceView.D elete(IDictiona ry keys, IDictionary
oldValues, DataSourceViewO perationCallbac k callback) +75
System.Web.UI.W ebControls.Form View.HandleDele te(String commandArg) +855
System.Web.UI.W ebControls.Form View.HandleEven t(EventArgs e, Boolean
causesValidatio n, String validationGroup ) +784
System.Web.UI.W ebControls.Form View.OnBubbleEv ent(Object source, EventArgs
e) +95
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +35
System.Web.UI.W ebControls.Form ViewRow.OnBubbl eEvent(Object source,
EventArgs e) +109
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +35
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e) +115
System.Web.UI.W ebControls.Link Button.RaisePos tBackEvent(Stri ng
eventArgument) +134

System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra isePostBackEven t(String eventArgument) +7
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +180
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5670

Nov 19 '05 #2
Without seeing some code, I cannot be 100% sure, but here is a hint that may
help you solve the issue:

The exception is stating you do not have a default constructor on an object,
so it cannot create the object in question without parameters, which are not
supplied in this context.

Step through your code and examine the call stack at the point the exception
is thrown. This will show the point of failure.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************
"John Bailey" wrote:
I am using a formview with an ObjectDatasourc e in ASP .Net 2.0. Everything
works fine until I try the delete. The ItemDeleting event fires, so I know
it should fire my delete method, but instead I get an error: No parameterless
constructor defined for this object, and the delete method is never called.

Anyone have any ideas?

Nov 19 '05 #3
First of all, thank you for replying.

I posted the stack trace in a reply to my original message. The problem is
that the error is being generating outside of my code. I have developed
another theory, but have not had the opportunity to test it. When I first
set this up, I got an error saying that the objectdatasourc e could not find a
method with the parameters oringal_Key, Key. My delete method originally
only took the Key as a parameter. I changed this and then got the default
constructor error. I am thinking that they key field may be setup as
read/write when it should be readonly or something to that effect.

Does that sound plausible?

"Cowboy (Gregory A. Beamer) - MVP" wrote:
Without seeing some code, I cannot be 100% sure, but here is a hint that may
help you solve the issue:

The exception is stating you do not have a default constructor on an object,
so it cannot create the object in question without parameters, which are not
supplied in this context.

Step through your code and examine the call stack at the point the exception
is thrown. This will show the point of failure.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************
"John Bailey" wrote:
I am using a formview with an ObjectDatasourc e in ASP .Net 2.0. Everything
works fine until I try the delete. The ItemDeleting event fires, so I know
it should fire my delete method, but instead I get an error: No parameterless
constructor defined for this object, and the delete method is never called.

Anyone have any ideas?

Nov 19 '05 #4
Boy, now I feel like an idiot. My delete method was not shared, so the
objectdatasourc e was creating an instance of the object automatically. The
object class did not have a default constructor, so it generated an error.

I made the method shared and it works perfectly.

"Cowboy (Gregory A. Beamer) - MVP" wrote:
Without seeing some code, I cannot be 100% sure, but here is a hint that may
help you solve the issue:

The exception is stating you do not have a default constructor on an object,
so it cannot create the object in question without parameters, which are not
supplied in this context.

Step through your code and examine the call stack at the point the exception
is thrown. This will show the point of failure.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************
"John Bailey" wrote:
I am using a formview with an ObjectDatasourc e in ASP .Net 2.0. Everything
works fine until I try the delete. The ItemDeleting event fires, so I know
it should fire my delete method, but instead I get an error: No parameterless
constructor defined for this object, and the delete method is never called.

Anyone have any ideas?

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2310
by: Matthew Wells | last post by:
I want to delete records from the "one" table of a one to may relationship. There are no actual Access relationships set up. The "one" table has a single field PK and the "many" table has a two field PK. This code works when executed from a module (both DAO and ADO work), but not from the query window. DELETE a1.*, a2.Field1 FROM a1 LEFT JOIN a2 ON a1.Field1 = a2.Field1 WHERE (((a2.Field1) Is Null));
4
4586
by: @ndy | last post by:
I import an excel sheet to access and know i won't to delete some columns. This my code that doesn't work. strSQLAlter = "ALTER TABLE ImpTableB DROP COLUMN Dossier-beheerder" DoCmd.RunSQL strSQLAlter
2
1378
by: Spongebob | last post by:
Hello! I tried to use this code from Peter Torr: Foo.Attributes("onclick") = "if (confirm('delete?') == false) return false; " + Foo.Attributes("onclick") It works nomral on IE5, Windows 2000. ....Oh, but on IE6, Windows XP it seems to return always true (the result is always "ok", record is always deleted, users can be upset
10
6554
by: Jarod | last post by:
Hey var service = this.WebServiceURL +"/SessionFun?sessionID="+ this.SessionID ; var xmlDoc=document.implementation.createDocument("", "", null); try {
0
1260
by: zhengmao | last post by:
I have one store procedure, which works fine in SQL Analyzer when I test it out, but doesn't work when I call it in web application. the problem is it doesn't insert last line, and the problem is that one Select statement doesn't execute, does anyone have a clue for this? IF @CourseList <> '' AND @EmployeeID <> 'DELETE' BEGIN SELECT @npos1Course = 1 SELECT @npos1RBY = 1 SELECT @nLoop = 1 SELECT @nBreak = 0 ...
2
1457
by: ruthiefy | last post by:
Hi, I am new to ASP.NET and I started working with 2005. I opened a new project and in the Default.aspx Web Form I clicked the "Design" button in the bottom of the screen so I can edit the layout. For some reason, the "Design" button doesn't work and I can't access the screen layout !!! Besides: the Enter, Backspace and Delete buttons stop working after I
1
1950
by: Swinky | last post by:
I have added code to delete a record (and records in related tables) in the OnClick property: MsgBox "Confirm delete. Once you confirm, record will no longer exist.", vbOKCancel strSQL = "DELETE FROM TOrdAck WHERE OANo=" & Me!OANo Set dbs = CurrentDb dbs.Execute strSQL, dbFailOnError MsgBox dbs.RecordsAffected & " record(s) deleted"
0
1041
by: cmrchs | last post by:
Hi, I want to bind an ObjectDataSource to a VS.NET Dataset but it doesn't work. here's what i do: - I add a new DataSet (ProductsDs) to the App_Code folder of the web- project - I run the tableAdapter wizard and specify connection, Sql- statements and stuff ... and press Finish
0
1252
by: Bobby Edward | last post by:
I'm trying to filter an objectdatasource based on words in a textbox. Here's how I'm doing it... With odsProjects .FilterParameters.Clear() .FilterExpression = "ProjectTitle LIKE %{0}%" Dim p As New System.Web.UI.WebControls.Parameter("ProjectTitle", Data.DbType.String, txtKeywords.Text) .FilterParameters.Add(p) .DataBind()
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9447
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9307
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.