Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

wwwxxx0cm, www.webdp.net, Event 9 IIS log failed to write entry, wwwxxx jeffs, Catastrophic failure Unexpected method call sequence. 0x8000ffff (-2147418113)., ksh lock a file, [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_DBC failed, sed: -e expression #1, char 1: unterminated address regex, procmail + change subject, w2ksp4.exe download

Links

XODOX
Impressum

#1: Exception "Object must implement IConvertible" for multiple-field DataKeyNames in a GridVi

Posted on 2008-04-08 23:41:25 by 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(Object value, String
defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean
ignoreNullableTypeChanges) +264
System.Web.UI.WebControls.ObjectDataSourceView.MergeDictiona ries(ParameterCollection
reference, IDictionary source, IDictionary destination, String
parameterNameFormatString) +439
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteDelete (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,

Report this message