i have the following line of code. i am passing in some items in a querystring, one of which is a value with the type of double. however, i am getting an error when it gets to this line of code saying, for example, 1.33 is not a valid value for Int32. this
is because it cant seem to convert the double value. does anyone know how i can solve this problem and pass in a double value?
var deserialized = new JavaScriptSerializer().Deserialize<IEnumerable<ViewModel>>(querystring);
Could you explain more of your question? What's your ViewModel? And what the value of querystring when your got error? What's the expect value of querystring?
Regards
Please mark the replies as answers if they help or unmark if not.
Feedback to us
young345
Member
201 Points
720 Posts
pass in a double value and deserialize?
May 10, 2012 03:06 AM|LINK
hi,
i have the following line of code. i am passing in some items in a querystring, one of which is a value with the type of double. however, i am getting an error when it gets to this line of code saying, for example, 1.33 is not a valid value for Int32. this is because it cant seem to convert the double value. does anyone know how i can solve this problem and pass in a double value?
var deserialized = new JavaScriptSerializer().Deserialize<IEnumerable<ViewModel>>(querystring);
thank you very much
ignatandrei
All-Star
135047 Points
21654 Posts
Moderator
MVP
Re: pass in a double value and deserialize?
May 10, 2012 03:38 AM|LINK
What is the ViewModel that you try to deserialize and what's the querystring?
are you sure that this is the line?
Please provide a small example to be reproduced.
Young Yang -...
All-Star
21343 Points
1818 Posts
Microsoft
Re: pass in a double value and deserialize?
May 17, 2012 01:46 AM|LINK
Could you explain more of your question? What's your ViewModel? And what the value of querystring when your got error? What's the expect value of querystring?
Regards
Feedback to us
Develop and promote your apps in Windows Store