Row updating throwing exception at postback

Answered (Not Verified) This post has 0 verified answers | 14 Replies | 2 Followers Thread's RSS feed.

PV85281
Points 795
Replied On: Tue, Oct 4 2011 10:25 AM Reply

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) +5201

What is wrong?

  • Post Points: 35

All Replies

[Infragistics] Alex E
Points 15,789
Infragistics Employee
Replied On: Wed, Oct 5 2011 10:12 AM Reply

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.

Regards,
Alex
Web Team

  • Post Points: 20
PV85281
Points 795
Replied On: Thu, Oct 6 2011 3:28 AM Reply

We use NetAdvantage 2011 V1 and the exact Version of Infragistics4.Web.v11.1 is: 11.1.20111.1006

I have VS 2010 Ultimate on Win7.

  • Post Points: 20
anandraj
Points 670
Replied On: Thu, Oct 6 2011 5:01 AM Reply

Hi

i am new to webdatagrid

 

i use NetAdvantage 2011 V1(Infragistics4.Web.v11.1)

"could you kindly give me a sample for editing values in webdatagrid.?"

 

 

 

  • Post Points: 20
[Infragistics] Alex E
Points 15,789
Infragistics Employee
Replied On: Mon, Oct 10 2011 9:31 AM Reply

Hello PV85281,

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.

Regards,
Alex
Web Team

  • Post Points: 20
[Infragistics] Alex E
Points 15,789
Infragistics Employee
Replied On: Mon, Oct 10 2011 9:32 AM Reply

Regards,
Alex
Web Team

  • Post Points: 20
anandraj
Points 670
Replied On: Tue, Oct 11 2011 12:30 AM Reply

ok thanks for these links.

One more thing needed, i want to load the grid when load button was clicked, and want to edit the grid data ?

these samples load the grid in page load event and were editable.

i need to edit the grid after loaded from button click event.

 

  • Post Points: 5
PV85281
Points 795
Replied On: Thu, Oct 13 2011 10:20 AM Reply

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.

 

  • Post Points: 5
PV85281
Points 795
Replied On: Fri, Oct 14 2011 4:40 AM Reply

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?

  • Post Points: 20
[Infragistics] Alex E
Points 15,789
Infragistics Employee
Replied On: Tue, Oct 18 2011 9:09 AM Reply

Hello PV85281,

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.

Thank you.

Regards,
Alex
Web Team

  • Post Points: 20
PV85281
Points 795
Replied On: Fri, Oct 21 2011 9:32 AM Reply

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.

  • Post Points: 20
[Infragistics] Alex E
Points 15,789
Infragistics Employee
Replied On: Wed, Oct 26 2011 10:42 AM Reply

Hello PV85281,

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.

Regards,
Alex
Web Team

  • Post Points: 20
PV85281
Points 795
Replied On: Thu, Oct 27 2011 9:31 AM Reply

I already knew that the "DataKeyFields" property is used to identify the unique records in the Data Source. But in either article there is no word about the required datatype of the columns specified in this property!

Did you read my post?!

 

The question was:

Is it correct that the column specified in the "DataKeyFields" property got to be data type "integer"? (Because with columns with data type "string" my tests doesn't work.)

Please start answer with simple "Yes" or "No".

 

Thanks.

  • Post Points: 5
[Infragistics] Alex E
Points 15,789
Infragistics Employee
Answered (Not Verified) Replied On: Tue, Nov 1 2011 9:46 AM Reply
Suggested by [Infragistics] Alex E

Hello PV85281,

The answer to your question is “No” – the key field does not have to be only integer type.

Technically it can be any type of data, but proper serialization of some data types can cause issues.

I am sending you an example that uses “string” data as a primary key and key field for the grid.

You can see that the grid is working as expected when row is added to it.

Test the example and let me know if you have additional questions.

Regards,
Alex
Web Team

  • Post Points: 5
[Infragistics] Alex E
Points 15,789
Infragistics Employee
Replied On: Mon, Nov 7 2011 9:47 AM Reply

Hello PV85281,

Inform me if you have additional questions.

Regards,
Alex
Web Team

  • Post Points: 5
Page 1 of 1 (15 items) | RSS