Fix for ObjectDataSource delete method - object value passed to the delete method is null

by APIJunkie 3. September 2009 19:54

I recently stumbled upon a not very well documented "design feature" that took me a couple of hours to track down.

If you are defining a custom delete function for an ObjectDataSource you must also remember to define the DataKeyNames property of the GridView you are working with. If you do not remember to do this, the object’s value passed to your delete function will be null.

You can read more about the ObjectDataSource delete issue here.

Hope this helps!

Tags:

ASP.NET | PRB | Troubleshoot

Comments

10/13/2009 12:24:09 PM #

ASPManiac

Thanks APIJunkie,

Your post helped me with my delete method...

ASPManiac Canada

Comments are closed

About the author

Name of author

I was first wounded by x86 assembly, recovered and moved on to C. Following a long addiction to C++ and a short stint at rehab I decided to switch to a healthier addiction so I am now happily sniffing .NET and getting hooked on Silverlight.

I am mainly here to ramble about coding, various API’s, Junkies(me especially) and everything else that happens between coders and their significant other.

  James Bacon