I am using version 2011.1.
I am using webdatagrid to display a table which has a primary key column , EntityID , of integer type.
I bind the datagrid using an <asp:sqldatasource>.
I am getting an error:
The default value string, , for column EntityID cannot be converted to the correct type, System.Int32
The stored procedure to return the table data does not have a parameter. It is just a simple select statement.
I do not have a problem when the primary key column is of string type.
In my sqldatasource, I tried various alternatives, including and excluding the following line:
<selectparameters></selectparameters>
but it is still not working.
I am wondering if there is anything special about binding to a grid with a integer primary key.
Below is my aspx code.
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/EntityExplorer.Master" CodeBehind="EntitySubprogram.aspx.cs" Inherits="EPEDIS_Entity_Explorer.Admin.Reference.EntitySubprogram" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><asp:content ID="Content1" ContentPlaceHolderID="cphHead" runat="server"></asp:content><asp:content ID="Content2" ContentPlaceHolderID="cphMain" runat="server"> <ig:webdatagrid ID="wdg" runat="server" Height="500px" Width="975px" AutoCRUD="true" AutoGenerateColumns="False" DataKeyFields="EntityID" DataSourceID="SqlDataSource1" DataMember="DefaultView" > <Columns> <ig:BoundDataField DataFieldName="EntityID" Key="EntityID" width="60px" datatype="Int32" > <Header Text="Entity ID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="programCode" Key="programCode" width="80px" datatype="string"> <Header Text="Program Code" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="region" Key="region" width="120px"> <Header Text="region" /> </ig:BoundDataField > </Columns> <Behaviors> <ig:EditingCore> <editingclientevents rowsdeleting="confirm_delete" /> <Behaviors> <ig:CellEditing> <columnsettings> <ig:editingcolumnsetting columnkey="EntityID" readonly="True" /> </columnsettings> <EditModeActions EnableOnKeyPress="True" MouseClick="Single" /> </ig:CellEditing> <ig:rowdeleting /> <ig:RowAdding> <columnsettings> <ig:rowaddingcolumnsetting columnkey="EntityID" /> </columnsettings> <EditModeActions MouseClick="Single" EnableOnActive="True" enableonkeypress="True"> </EditModeActions> </ig:RowAdding> </Behaviors> </ig:EditingCore> <ig:Activation /> <ig:selection cellclickaction="Row" rowselecttype="Single"> </ig:selection> <ig:rowselectors> </ig:rowselectors> </Behaviors> </ig:webdatagrid> <asp:sqldatasource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EpedisConnectionString %>" Deletecommand="Delete_Entity" Deletecommandtype="StoredProcedure" InsertCommand="Update_Entity" InsertCommandType="StoredProcedure" SelectCommand="Get_Entity" selectcommandtype="StoredProcedure" UpdateCommand="Update_Entity" UpdateCommandType="StoredProcedure"> <UpdateParameters> <asp:Parameter Name="EntityID" Type="Int32"/> <asp:Parameter Name="programCode" Type="String" /> <asp:Parameter Name="region" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="EntityID" Type="Int32" /> <asp:Parameter Name="programCode" Type="String" /> <asp:Parameter Name="region" Type="String" /> </InsertParameters> <deleteparameters> <asp:Parameter Name="EntityID" Type="Int32" /> </deleteparameters> </asp:sqldatasource> <asp:button ID="btnUpdate" runat="server" Text="Update" cssclass="btn_3D_Bold" /> </script></asp:content>
It appears that this is a known issue.
Someone else also reported this issue: http://forums.infragistics.com/forums/p/56823/290678.aspx.
In the above post, the issue was identified as:
Issue 78973 : "The default value string for column cannot be converted to the correct type" is thrown if DefaultValueAsString is not set
Hello erichardson ,
The issue is fixed and is included in the latest service release :
http://forums.infragistics.com/forums/p/44546/287331.aspx#287331
Let us know if you still experience it after installing it.
I went to My IG => My Keys and Downloads and do not see the service release available. All I see are version version 2010 Vol. 3 and 2011 Vol. 1.
I registered the product (just to make sure) and it told me that the product has already been registered.
Am I looking at the wrong place? Thanks.
If you click on the version you would be able to see the Service releases:
http://forums.infragistics.com/forums/p/30954/170591.aspx#170591