I'm currently making it possible for people to import xml files into via import in the content section in umbraco.. for that I've created a user control.
Now my problem is this:
I'm looking to parse the NodeId to int:
if (!string.IsNullOrEmpty(NodeId.Text.ToString()))
{
parrentNodeid = int.Parse(String NodeId.Text);
}
But this results in the following errors:
[FormatException: Input string was not in a correct format.]
Can you tell me what is not the correct format and how I should do it differently? Would be a big help!!
Parsing NodeId as text to int
Hey guys!
I'm currently making it possible for people to import xml files into via import in the content section in umbraco.. for that I've created a user control.
Now my problem is this:
I'm looking to parse the NodeId to int:
But this results in the following errors: [FormatException: Input string was not in a correct format.]
Can you tell me what is not the correct format and how I should do it differently? Would be a big help!!
Have a look at this SO question: http://stackoverflow.com/questions/8321514/input-string-was-not-in-a-correct-format#8321527
There probably is a value which you can't convert to an int. Maybe there is a corrupt value in the import file. Try using int.TryParse.
Jeroen
is working on a reply...