Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hopefully this is a simple one...
i have an xml chunk i am reading in with razor...
<RangeShown lower="1" upper="11"/>
all i want to do is subract lower from upper... but i am having issues casting the strings as numbers...
so i get this...
String upper = doc.SelectSingleNode("/SearchResults/RangeShown/@upper").Value; String lower = doc.SelectSingleNode("/SearchResults/RangeShown/@lower").Value;
and i want to change them into ints so i can do some simple math..
int upperLimit = upper; int lowerLimit = lower; int numPerPage = upperLimit - lowerLimit;
but the int statements for upperLimit and lowerLimit obviously error... please help me to understand razor better ;)
I'm no razor guru, but if it is anything like regular C#, you should be able to do:
int upperLimit = int.Parse(upper);
and so on...
yeah it was wierd... int.Parse() was not working -- throwing an error... however
Convert.ToInt32() worked great... grrrr
Lovely :-)
Maybe because of the capitalised "String" instead of "string".
Anyways, good to know :)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
razor and math functions with data from xml
Hopefully this is a simple one...
i have an xml chunk i am reading in with razor...
all i want to do is subract lower from upper... but i am having issues casting the strings as numbers...
so i get this...
and i want to change them into ints so i can do some simple math..
but the int statements for upperLimit and lowerLimit obviously error... please help me to understand razor better ;)
I'm no razor guru, but if it is anything like regular C#, you should be able to do:
int upperLimit = int.Parse(upper);
and so on...
yeah it was wierd... int.Parse() was not working -- throwing an error... however
Convert.ToInt32() worked great... grrrr
Lovely :-)
Maybe because of the capitalised "String" instead of "string".
Anyways, good to know :)
is working on a reply...