First off I am fairly new to C# but I am trying to convert a string to an Int. I get no errors in Visual Studio but when I actually try to preview my page in Sitecore I get an Error. The error is System.FormatException: Input string was not in a correct format.
This is my code:
public string numColumnStr = "";
numColumnStr = parameters.columns;
int numColumns = 2;
if (numColumns != null)
numColumns = Convert.ToInt32(numColumnStr);
I want the default value of the columns to be 2. and i have
parameters.columns? I also don't get why you're doingif (numColumns != null)when you're directly settingnumColumnsthe line before...