tags:

views:

70

answers:

2

Sorry if the question sounds stupid... but how do I convert an SPFieldNumber into an int in C#?

I tried Convert.ToInt32, but doesnt seem to be working.

Thanks.

A: 

What if you tried to get a string representation of the SPFieldNumber object and then use Int32.Parse(spfieldnumber_string_value) ?

Robert Williams
+1  A: 

You should be able to do something like:

Convert.ToInt32(MySPFieldNumber.GetFieldValue());
Convert.ToInt32(MySPFieldNumber.GetFieldValueAsText());
code4life
The second line was what I had... something else buggered up my code. Thanks!
BeraCim