473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
uniqueidentifier and c2 is int.

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

I have a ObjectDataSource defined with following delete params:
<DeleteParameters>
<asp:Parameter Name="c1", Type="String" />
<asp:Parameter Name="c2" Type="Inte32" />
<DeleteParameters>

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
GridViewDeleteArgs.Keys. The dictionary looks fine there, including key
names and values.
Partial stack dump of the exception that I get afterwards:

[InvalidCastException: Object must implement IConvertible.]
System.Convert.ChangeType(Object value, TypeCode typeCode,
IFormatProvider provider) +2561730
System.Web.UI.WebControls.Parameter.GetValue(Objec t value, String
defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean
ignoreNullableTypeChanges) +264
System.Web.UI.WebControls.ObjectDataSourceView.Mer geDictionaries(ParameterCollection
reference, IDictionary source, IDictionary destination, String
parameterNameFormatString) +439
System.Web.UI.WebControls.ObjectDataSourceView.Exe cuteDelete(IDictionary
keys, IDictionary oldValues) +846
System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary
oldValues, DataSourceViewOperationCallback callback) +75
[...]

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

Apr 8 '08 #1
0 1966

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

Similar topics

1
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...
3
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...
4
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. --->...
18
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,...
1
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...
3
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...
1
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...
0
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...
0
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...

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.