I have a problem with updating data in the grid, i checked all the samples and could not find the missing thing to get it to work.
My aspx site is getting a command, this command is getting executed against a sql db with the option to get only the schema. Then i add a empty row to it, and fill the DataKeyFields column with some key.
But when i want to postback the values that the user inserted into to the other columns (than the DataKeyFields column), the web application crashes with following exception:
Input string was not in a correct format. 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.FormatException: Input string was not in a correct format. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [FormatException: Input string was not in a correct format.] Infragistics.Web.UI.Framework.Data.DataViewDataSourceAdapter.Update(Object dataItem, IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +1398 Infragistics.Web.UI.Framework.Data.DataSourceObjectView.Update(Object dataItem, IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +62 Infragistics.Web.UI.GridControls.EditingCore.OnAction(String actionType, Object id, Object value, Object tag) +3970 Infragistics.Web.UI.GridControls.GridBehavior.Infragistics.Web.UI.GridControls.IGridBehavior.OnAction(String actionType, Object id, Object value, Object tag) +48 Infragistics.Web.UI.GridControls.GridBot.LoadAdditionalClientState(Object state) +1313 Infragistics.Web.UI.Framework.RunBot.HandleRaisePostDataChangedEvent() +204 Infragistics.Web.UI.GridControls.GridBot.HandleRaisePostDataChangedEvent() +74 Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.RaisePostDataChangedEvent() +37 System.Web.UI.Page.RaiseChangedEvents() +134 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5201What is wrong?
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[FormatException: Input string was not in a correct format.] Infragistics.Web.UI.Framework.Data.DataViewDataSourceAdapter.Update(Object dataItem, IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +1398 Infragistics.Web.UI.Framework.Data.DataSourceObjectView.Update(Object dataItem, IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +62 Infragistics.Web.UI.GridControls.EditingCore.OnAction(String actionType, Object id, Object value, Object tag) +3970 Infragistics.Web.UI.GridControls.GridBehavior.Infragistics.Web.UI.GridControls.IGridBehavior.OnAction(String actionType, Object id, Object value, Object tag) +48 Infragistics.Web.UI.GridControls.GridBot.LoadAdditionalClientState(Object state) +1313 Infragistics.Web.UI.Framework.RunBot.HandleRaisePostDataChangedEvent() +204 Infragistics.Web.UI.GridControls.GridBot.HandleRaisePostDataChangedEvent() +74 Infragistics.Web.UI.Framework.Data.FlatDataBoundControl.RaisePostDataChangedEvent() +37 System.Web.UI.Page.RaiseChangedEvents() +134 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5201What is wrong?
Hello PV85281,
Can you tell me what version of our controls do you use and what is the build version of these controls?
Thank you.
What you can do first is to install the latest Service Release for version 11.1 of our controls and test this behavior again.
You can see our latest service releases in our web site - “Support > Service Releases” and download them from “My IG > My Keys and Downloads” page.
If you cannot see/download our latest service release you may need to register your product key first. You can register your product key in “Support > Register Your Product” page.
Let me know what the results are with the latest Service Release installed.
Hi Alexander
I've downloaded and installed the latest service release for ASP.NET. And now i get this error for the WebScriptManager:
ASP.NET runtime error: The base class includes the field 'WebScriptManager1', but its type (Infragistics.Web.UI.WebScriptManager) is not compatible with the type of control (Infragistics.Web.UI.WebScriptManager).
and a similiar one for the WebDataGrid.
The sample is working again, i had to manually change all version numbers in the web.config and aspx files.
But the same error as before the service release persists.
Any help?
Did you set the column data types to match the ones returned from the Database?
Do you also provide the data to the grid on every Postback?
In order to research this further I will need a working sample that can be run and debugged locally. Isolate your sample and send it to me for further research.
The grid columns was auto generated and i did provide the data at every postback.
But now i got it working.
Is it correct that the DataKeyFields have to be datatype integer? And when the datasource is a datatable, the DataKeyFields has to be the DataTable.PrimaryKeys to get edditing working?
What when my primary key is datatype string? This isn't uncommon.
Thank you for your feedback.
“DataKeyFields” property is used to identify the unique records in the Data Source. These records are in most cases the Primary Key records in the Data Source. Since the primary keys are in most cases with “integer” type, this property is pointing to them - http://help.infragistics.com/Help/NetAdvantage/ASPNET/2011.1/CLR4.0/html/Infragistics4.Web.v11.1~Infragistics.Web.UI.Framework.Data.FlatDataBoundControl~DataKeyFields.html
You can read more about this property and why it is important here - http://help.infragistics.com/Help/NetAdvantage/ASPNET/2010.3/CLR4.0/html/WebHierarchicalDataGrid_About_Data_Binding.html
Let me know if you need further information about this question.