Click here to Skip to main content
15,915,094 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
DataTable ItemDetails = JsonConvert.DeserializeObject<DataTable>(System.Uri.UnescapeDataString(hidItemDetails.Value));

C#
Input string was not in a correct format.Couldn't store <1454.42> in BasicAmount Column.  Expected type is Int64.


The datable mentioned here contain first row with BasicAmount as interger value & second row is float .
Posted
Comments
Sreekanth Mothukuru 27-Jun-15 2:45am    
I see there is a problem with "System.Uri.UnescapeDataString". You are talking about DataTable and using Uri unescape method.

Need more clarity why you are using System.Uri.UnescapeDataString method.
Ni!E$H_WAGH 27-Jun-15 6:04am    
Because am using Hidden field for fetching values from client side to server side , and after storing Json into hidden field it stores string like this "%5B%7B%22Flag%22%3A0%2C%22BillNumber%22%3A%2203%22%2C%22POId%22%3A13%2C%22GRNId%22%3A9%2C%22PartyId%22%3A9%2C%22ItemId%22%3A15%2C%22ItemName%22%3A%22INSERT%20AIR%20FILTER%20%20BM150%20-%200%22%2C%22Unit%22%3A%22Nos%22%2C%22Quantity%22%3A8000%2C%22Rate%22%3A2%2C%22BasicAmount%22%3A16000%2C%22Total%22%3A20250%2C%22Remark%22%3A%22na%22%7D%2C%7B%22Flag%22%3A0%2C%22BillNumber%22%3A%2203%22%2C%22POId%22%3A13%2C%22GRNId%22%3A9%2C%22PartyId%22%3A9%2C%22ItemId%22%3A15%2C%22ItemName%22%3A%22INSERT%20AIR%20FILTER%20%20BM150%20-%200%22%2C%22Unit%22%3A%22Nos%22%2C%22Quantity%22%3A8000%2C%22Rate%22%3A2%2C%22BasicAmount%22%3A16000%2C%22Total%22%3A20250%2C%22Remark%22%3A%22na%22%7D%2C%7B%22GRNId%22%3A%220%22%2C%22Flag%22%3A%220%22%2C%22ItemName%22%3A%22POLY%20BAG%20BUBBLE140*170*300G%20EXPORT%20MIR%22%2C%22Unit%22%3A%22Nos%22%2C%22Quantity%22%3A%2212012%22%2C%22Rate%22%3A%221.259%22%2C%22BasicAmount%22%3A%2215123.11%22%2C%22Total%22%3A%220%22%2C%22Remark%22%3A%22%22%7D%5D
that why am using System.Uri.UnescapeDataString() method.
"

1 solution

Newtonsoft.Json.JsonConvert.DeserializeObject<datatable>(yourstring);

If you are using Newtonsoft DLL.

if you are getting error in serialize.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900