473,654 Members | 3,062 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exception "Object must implement IConvertible" for multiple-field DataKeyNames in a GridView

dan
Hi,

I've been using a GridView for some time but this is the first time I need
to delete a row in the grid whose primary key consists of 2 fields (table
columns). I have a table with primary key set to c1,c2 where c1 is a
uniqueidentifie r and c2 is int.

The DataKeyNames in the gridview is defined as follows:
DataKeyNames="c 1,c2".

I have a ObjectDataSourc e defined with following delete params:
<DeleteParamete rs>
<asp:Paramete r Name="c1", Type="String" />
<asp:Paramete r Name="c2" Type="Inte32" />
<DeleteParamete rs>

The ods is mapped to a bll's method Delete(string, int). Unfortunately the
method never gets called.

I attached RowDeleting event handler to the gridview to see the content of
GridViewDeleteA rgs.Keys. The dictionary looks fine there, including key
names and values.
Partial stack dump of the exception that I get afterwards:

[InvalidCastExce ption: Object must implement IConvertible.]
System.Convert. ChangeType(Obje ct value, TypeCode typeCode,
IFormatProvider provider) +2561730
System.Web.UI.W ebControls.Para meter.GetValue( Object value, String
defaultValue, TypeCode type, Boolean convertEmptyStr ingToNull, Boolean
ignoreNullableT ypeChanges) +264
System.Web.UI.W ebControls.Obje ctDataSourceVie w.MergeDictiona ries(ParameterC ollection
reference, IDictionary source, IDictionary destination, String
parameterNameFo rmatString) +439
System.Web.UI.W ebControls.Obje ctDataSourceVie w.ExecuteDelete (IDictionary
keys, IDictionary oldValues) +846
System.Web.UI.D ataSourceView.D elete(IDictiona ry keys, IDictionary
oldValues, DataSourceViewO perationCallbac k callback) +75
[...]

Could someone please let me know how to troubleshoot this?
Thanks,

Apr 8 '08 #1
0 1977

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

Similar topics

1
2670
by: Robert A Riedel | last post by:
I am completely baffled when the following managed exception is thrown: "Object reference not set to an instance of an object" from a nested subroutine when referencing a variable allocated on the program stack. Given the following simple example: void T( System::String * S ) { const wchar_t __pin * pchars PtrToStringChars( S ) ;
3
9251
by: Jens | last post by:
Hi I am writing a ASP.NET web application that must sent some e-mails. I get the exception “Could not access 'CDO.Message' object” when I call SmtpMail.Send. This only happens when I send e-mail addresses out side my company walls. When the e-mail is send on some one in my company it works perfect. I think it is a relay issue. Our system administrator will not allow relaying. In the ASP.Net web.config file I let the web application...
4
3966
by: Liz Patton | last post by:
Here's the exception: System.Exception: Unable to send mail: Could not access 'CDO.Message' object. ---> System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80004005): Unspecified error --- End of inner exception stack trace ---
18
28742
by: Microsoft | last post by:
When I try this in my code I alwas get an errormessage: "Object reference not set to an instance of an object" Dim g As System.Drawing.Graphics g.DrawString("Test", New Font("Arial", 12, FontStyle.Bold), Brushes.Black, 0, 0) Why is this? Marc
1
2434
by: dan | last post by:
I am using VB.NET 2003 and SQL Server 2000. My program inserts new rows in a SQL table based on data read from a file. I generated the commands and the stored procedures with the DataAdapter wizard. The execution of the Insert Command throws the exception: "Object must implement IConvertible. " 1. What object does it refer to? The Command itself? 2. On the other hand, in the VS Help file all IConvertible members have this warning:...
3
2630
by: dan | last post by:
I am using VB.NET 2003 and SQL Server 2000. My program inserts new rows in a SQL table based on data read from a file. I generated the commands and the stored procedures with the DataAdapter wizard. The execution of the Insert Command throws the exception: "Object must implement IConvertible. " 1. What object does it refer to? The Command itself? 2. On the other hand, in the VS Help file all IConvertible members have this warning:...
1
1126
by: jk | last post by:
Hi, I'm trying to add an object to a checked listbox using VC++2005 Express. I tries adding a managed String (String ^) and objects that implement their own version of the ToString() method. I always get the same error message: "object reference not set to an instance of an object". The objects are initialized and I can see them and their content in the debugger - everything's fine until I hit the myListBox->Items->Add(myString,false);...
0
2213
by: =?Utf-8?B?SkhhbGV5?= | last post by:
Our system is: IIS Server: dual Intel Xeon 2.80 GHz, 4 GB Ram Windows Server 2003 SP2 IIS 6.0 SQL Server: dual Intel Xeon 2.80 GHz, 4 GB Ram (separate server) Windows Server 2003 SP2 SQL Server 2000 We are having some problems with a website we are developing, and had some
0
2645
by: Tamer Ibrahim | last post by:
Hi, Sometimes, I got the following error message when I use ajax calendar control on some aspx pages : Object reference not set to an instance of an 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.NullReferenceException: Object reference not set to an...
4
2166
by: My Pet Programmer | last post by:
Ok guys, I'm really looking for someone to tell me how bad a hack this is, and if I'm close to where I should be with it. The basic situation is that I have a class which creates a basic calendar control, the only difference is I stole the navigation scheme from Vista (e.g., if you click on the year you zoom out to the months list, then out to the decade, and back in when you click a year, then a month). I ran into some trouble...
0
8375
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8707
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...
1
8482
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8593
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...
0
5622
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
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1593
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.